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 '