diff --git a/libraries/chart.lib.php b/libraries/chart.lib.php index bf3b2c699..5b779c3b1 100644 --- a/libraries/chart.lib.php +++ b/libraries/chart.lib.php @@ -1,4 +1,8 @@ $dataValue) { + $key = ucwords(str_replace(array('Com_', '_'), array('', ' '), $dataKey)); + $value = (int)$dataValue; + $chartData[$key] = $value; + } + + //$chart = new PMA_OFC_Pie(__('Query type'), $chartData, $options); + $chart = new PMA_pChart_Pie(__('Query type'), $chartData); + echo $chart->toString(); +} - $chart = new PMA_OFC_Pie($titleText, $data, $options); +/* + * Formats a chart for profiling page. + */ +function PMA_chart_profiling($data) +{ + $chartData = array(); + foreach($data as $dataValue) { + $value = (int)($dataValue['Duration']*1000000); + $key = ucwords($dataValue['Status']); + $chartData[$key] = $value; + } + + $chart = new PMA_pChart_Pie( + __('Query execution time comparison (in microseconds)'), + $chartData, + array( + 'bgColor' => '#e5e5e5', + 'width' => 500, + 'height' => 325, + ) + ); echo $chart->toString(); } diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 8002bcb48..2b471934c 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1363,43 +1363,15 @@ function PMA_profilingResults($profiling_results, $show_chart = false) echo ''; if ($show_chart) { + require_once './libraries/chart.lib.php'; echo '
'; - PMA_profilingResultsChart($profiling_results); + PMA_chart_profiling($profiling_results); echo '
'; } echo '' . "\n"; } -/** - * Displays the results of SHOW PROFILE as a chart - * - * @param array the results - * @access public - * - */ -function PMA_profilingResultsChart($profiling_results) -{ - require_once './libraries/chart.lib.php'; - - $chart_data = array(); - foreach($profiling_results as $one_result) { - $value = (int)($one_result['Duration']*1000000); - $key = ucwords($one_result['Status']); - $chart_data[$key] = $value; - } - - echo PMA_chart_pie( - __('Query execution time comparison (in microseconds)'), - $chart_data, - array( - 'bgColor' => '#e5e5e5', - 'width' => 500, - 'height' => 300, - ) - ); -} - /** * Formats $value to byte view * diff --git a/server_status.php b/server_status.php index d82fc1963..3869cbbdf 100644 --- a/server_status.php +++ b/server_status.php @@ -592,13 +592,7 @@ foreach ($used_queries as $name => $value) {
$value) { - $key = str_replace(array('Com_', '_'), array('', ' '), $key); - $chart_data[ucwords($key)] = (int)$value; - } - echo PMA_chart_pie(__('Query type'), $chart_data); + echo PMA_chart_status($used_queries); ?>