added the chart in the profiling window
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
* @package phpMyAdmin
|
* @package phpMyAdmin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function PMA_chart_pie($titleText, $data)
|
function PMA_chart_pie($titleText, $data, $options = null)
|
||||||
{
|
{
|
||||||
require_once('./libraries/chart/pma_ofc_pie.php');
|
require_once('./libraries/chart/pma_ofc_pie.php');
|
||||||
|
|
||||||
$chart = new PMA_OFC_Pie($titleText, $data);
|
$chart = new PMA_OFC_Pie($titleText, $data, $options);
|
||||||
echo $chart->toString();
|
echo $chart->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,21 +11,21 @@ class PMA_Chart
|
|||||||
* Colors for the different slices in the pie chart.
|
* Colors for the different slices in the pie chart.
|
||||||
*/
|
*/
|
||||||
protected $colors = array(
|
protected $colors = array(
|
||||||
'#485E70',
|
|
||||||
'#484A70',
|
|
||||||
'#594870',
|
|
||||||
'#6D4870',
|
|
||||||
'#70485E',
|
|
||||||
'#70484A',
|
'#70484A',
|
||||||
'#705948',
|
'#705948',
|
||||||
'#706D48',
|
'#6D4870',
|
||||||
'#5E7048',
|
'#70485E',
|
||||||
'#4A7048',
|
'#485E70',
|
||||||
|
'#484A70',
|
||||||
'#487059',
|
'#487059',
|
||||||
'#48706D',
|
'#48706D',
|
||||||
'#5F7E95',
|
'#594870',
|
||||||
|
'#5E7048',
|
||||||
'#839CAF',
|
'#839CAF',
|
||||||
'#95775F',
|
'#95775F',
|
||||||
|
'#5F7E95',
|
||||||
|
'#706D48',
|
||||||
|
'#4A7048',
|
||||||
'#AF9683',
|
'#AF9683',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -44,15 +44,30 @@ class PMA_Chart
|
|||||||
*/
|
*/
|
||||||
protected $height = 250;
|
protected $height = 250;
|
||||||
|
|
||||||
/*
|
|
||||||
* Colors in the colors array have been written down in an gradient
|
|
||||||
* order. Without shuffling pie chart has an angular gradient.
|
|
||||||
* Colors could also be shuffles in the array initializer.
|
|
||||||
*/
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
shuffle(&$this->colors);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A function which handles passed parameters. Useful if desired
|
||||||
|
* chart needs to be a little bit different from the default one.
|
||||||
|
*
|
||||||
|
* Option handling could be made more efficient if options would be
|
||||||
|
* stored in an array.
|
||||||
|
*/
|
||||||
|
function handleOptions($options)
|
||||||
|
{
|
||||||
|
if (is_null($options))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (isset($options['bgColor']))
|
||||||
|
$this->bgColor = $options['bgColor'];
|
||||||
|
if (isset($options['width']))
|
||||||
|
$this->width = $options['width'];
|
||||||
|
if (isset($options['height']))
|
||||||
|
$this->height = $options['height'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -7,10 +7,12 @@ require_once('pma_ofc_chart.php');
|
|||||||
*/
|
*/
|
||||||
class PMA_OFC_Pie extends PMA_OFC_Chart
|
class PMA_OFC_Pie extends PMA_OFC_Chart
|
||||||
{
|
{
|
||||||
function __construct($titleText, $data)
|
function __construct($titleText, $data, $options = null)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->handleOptions($options);
|
||||||
|
|
||||||
include './libraries/chart/ofc/open-flash-chart.php';
|
include './libraries/chart/ofc/open-flash-chart.php';
|
||||||
|
|
||||||
// create and style chart title
|
// create and style chart title
|
||||||
@@ -43,4 +45,4 @@ class PMA_OFC_Pie extends PMA_OFC_Chart
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -1339,12 +1339,14 @@ function PMA_profilingCheckbox($sql_query)
|
|||||||
* Displays the results of SHOW PROFILE
|
* Displays the results of SHOW PROFILE
|
||||||
*
|
*
|
||||||
* @param array the results
|
* @param array the results
|
||||||
|
* @param boolean show chart
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function PMA_profilingResults($profiling_results)
|
function PMA_profilingResults($profiling_results, $show_chart = false)
|
||||||
{
|
{
|
||||||
echo '<fieldset><legend>' . __('Profiling') . '</legend>' . "\n";
|
echo '<fieldset><legend>' . __('Profiling') . '</legend>' . "\n";
|
||||||
|
echo '<div style="float: left;">';
|
||||||
echo '<table>' . "\n";
|
echo '<table>' . "\n";
|
||||||
echo ' <tr>' . "\n";
|
echo ' <tr>' . "\n";
|
||||||
echo ' <th>' . __('Status') . '</th>' . "\n";
|
echo ' <th>' . __('Status') . '</th>' . "\n";
|
||||||
@@ -1356,10 +1358,48 @@ function PMA_profilingResults($profiling_results)
|
|||||||
echo '<td>' . $one_result['Status'] . '</td>' . "\n";
|
echo '<td>' . $one_result['Status'] . '</td>' . "\n";
|
||||||
echo '<td>' . $one_result['Duration'] . '</td>' . "\n";
|
echo '<td>' . $one_result['Duration'] . '</td>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</table>' . "\n";
|
echo '</table>' . "\n";
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
if ($show_chart) {
|
||||||
|
echo '<div style="float: left;">';
|
||||||
|
PMA_profilingResultsChart($profiling_results);
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '</fieldset>' . "\n";
|
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
|
* Formats $value to byte view
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user