moved chart dependant code to the chart lib.
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once './libraries/chart/pma_ofc_pie.php';
|
||||
require_once './libraries/chart/pma_pChart_pie.php';
|
||||
|
||||
/**
|
||||
* Chart functions used to generate various types
|
||||
* of charts.
|
||||
@@ -7,11 +11,45 @@
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
function PMA_chart_pie($titleText, $data, $options = null)
|
||||
/*
|
||||
* Formats a chart for status page.
|
||||
*/
|
||||
function PMA_chart_status($data)
|
||||
{
|
||||
require_once('./libraries/chart/pma_ofc_pie.php');
|
||||
// format keys which will be shown in the chart
|
||||
$chartData = array();
|
||||
foreach($data as $dataKey => $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();
|
||||
}
|
||||
|
||||
|
@@ -1363,43 +1363,15 @@ function PMA_profilingResults($profiling_results, $show_chart = false)
|
||||
echo '</div>';
|
||||
|
||||
if ($show_chart) {
|
||||
require_once './libraries/chart.lib.php';
|
||||
echo '<div style="float: left;">';
|
||||
PMA_profilingResultsChart($profiling_results);
|
||||
PMA_chart_profiling($profiling_results);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</fieldset>' . "\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
|
||||
*
|
||||
|
@@ -592,13 +592,7 @@ foreach ($used_queries as $name => $value) {
|
||||
|
||||
<div>
|
||||
<?php
|
||||
// format keys which will be shown in the chart
|
||||
$chart_data = array();
|
||||
foreach($used_queries as $key => $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);
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user