diff --git a/libraries/chart.lib.php b/libraries/chart.lib.php index b653f9883..cb48945a9 100644 --- a/libraries/chart.lib.php +++ b/libraries/chart.lib.php @@ -27,11 +27,7 @@ function PMA_chart_status($data) //$chart = new PMA_OFC_Pie(__('Query type'), $chartData, $options); $chart = new PMA_pChart_Pie( __('Query statistics'), - $chartData, - array( - 'width' => 500, - 'height' => 325, - )); + $chartData); echo $chart->toString(); } @@ -49,13 +45,7 @@ function PMA_chart_profiling($data) $chart = new PMA_pChart_Pie( __('Query execution time comparison (in microseconds)'), - $chartData, - array( - 'bgColor' => '#e5e5e5', - 'width' => 500, - 'height' => 325, - ) - ); + $chartData); echo $chart->toString(); } diff --git a/libraries/chart/pma_chart.php b/libraries/chart/pma_chart.php index 0288b5d3a..e5b9fdeee 100644 --- a/libraries/chart/pma_chart.php +++ b/libraries/chart/pma_chart.php @@ -34,17 +34,17 @@ class PMA_Chart /* * Chart background color. */ - protected $bgColor = '#f5f5f5'; + protected $bgColor = '#E5E5E5'; /* * The width of the chart. */ - protected $width = 400; + protected $width = 500; /* * The height of the chart. */ - protected $height = 250; + protected $height = 325; function __construct($options = null) { @@ -70,6 +70,11 @@ class PMA_Chart if (isset($options['height'])) $this->height = $options['height']; } + + function getBgColorComp($component) + { + return hexdec(substr($this->bgColor, ($component * 2) + 1, 2)); + } } ?> diff --git a/libraries/chart/pma_pchart_pie.php b/libraries/chart/pma_pchart_pie.php index f2b305708..4bf886fa2 100644 --- a/libraries/chart/pma_pchart_pie.php +++ b/libraries/chart/pma_pchart_pie.php @@ -15,49 +15,53 @@ class PMA_pChart_Pie extends PMA_pChart_Chart require_once './libraries/chart/pChart/pChart.class'; // Dataset definition - $DataSet = new pData; - $DataSet->AddPoint(array_values($data),"Serie1"); - $DataSet->AddPoint(array_keys($data),"Serie2"); - $DataSet->AddAllSeries(); - $DataSet->SetAbsciseLabelSerie("Serie2"); + $dataSet = new pData; + $dataSet->AddPoint(array_values($data),"Values"); + $dataSet->AddPoint(array_keys($data),"Keys"); + $dataSet->AddAllSeries(); + $dataSet->SetAbsciseLabelSerie("Keys"); // Initialise the graph - $Test = new pChart($this->width, $this->height); + $chart = new pChart($this->width, $this->height); foreach ($this->colors as $key => $color) { - $Test->setColorPalette( + $chart->setColorPalette( $key, hexdec(substr($color, 1, 2)), hexdec(substr($color, 3, 2)), hexdec(substr($color, 5, 2)) ); } - $Test->setFontProperties($this->fontPath.'tahoma.ttf', 8); - $Test->drawFilledRoundedRectangle( + $chart->setFontProperties($this->fontPath.'tahoma.ttf', 8); + $chart->drawFilledRoundedRectangle( $this->border1Width, $this->border1Width, $this->width - $this->border1Width, $this->height - $this->border1Width, - 5,240,240,240); - $Test->drawRoundedRectangle( + 5, + $this->getBgColorComp(0), + $this->getBgColorComp(1), + $this->getBgColorComp(2) + ); + $chart->drawRoundedRectangle( $this->border1Width, $this->border1Width, $this->width - $this->border1Width, $this->height - $this->border1Width, - 5,230,230,230); + 5,0,0,0); // Draw the pie chart - $Test->AntialiasQuality = 0; - $Test->setShadowProperties(2,2,200,200,200); + $chart->AntialiasQuality = 0; + $chart->setShadowProperties(2,2,200,200,200); //$Test->drawFlatPieGraphWithShadow($DataSet->GetData(),$DataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,8); //$Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,255,255,218,2); - $Test->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,FALSE,60,30,10,1); - $Test->clearShadow(); + $chart->drawPieGraph($dataSet->GetData(),$dataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,FALSE,60,30,10,1); + $chart->clearShadow(); - $Test->drawTitle(10,20,$titleText,0,0,0); - $Test->drawPieLegend(340,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250); + $chart->drawTitle(20,20,$titleText,0,0,0); + $chart->drawPieLegend(350,15,$dataSet->GetData(),$dataSet->GetDataDescription(),250,250,250); ob_start(); - imagepng($Test->Picture); + imagepng($chart->Picture); $output = ob_get_contents(); ob_end_clean();