fixed default sizes and colors. Fixed some var names.
This commit is contained in:
@@ -27,11 +27,7 @@ function PMA_chart_status($data)
|
|||||||
//$chart = new PMA_OFC_Pie(__('Query type'), $chartData, $options);
|
//$chart = new PMA_OFC_Pie(__('Query type'), $chartData, $options);
|
||||||
$chart = new PMA_pChart_Pie(
|
$chart = new PMA_pChart_Pie(
|
||||||
__('Query statistics'),
|
__('Query statistics'),
|
||||||
$chartData,
|
$chartData);
|
||||||
array(
|
|
||||||
'width' => 500,
|
|
||||||
'height' => 325,
|
|
||||||
));
|
|
||||||
echo $chart->toString();
|
echo $chart->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,13 +45,7 @@ function PMA_chart_profiling($data)
|
|||||||
|
|
||||||
$chart = new PMA_pChart_Pie(
|
$chart = new PMA_pChart_Pie(
|
||||||
__('Query execution time comparison (in microseconds)'),
|
__('Query execution time comparison (in microseconds)'),
|
||||||
$chartData,
|
$chartData);
|
||||||
array(
|
|
||||||
'bgColor' => '#e5e5e5',
|
|
||||||
'width' => 500,
|
|
||||||
'height' => 325,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
echo $chart->toString();
|
echo $chart->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,17 +34,17 @@ class PMA_Chart
|
|||||||
/*
|
/*
|
||||||
* Chart background color.
|
* Chart background color.
|
||||||
*/
|
*/
|
||||||
protected $bgColor = '#f5f5f5';
|
protected $bgColor = '#E5E5E5';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The width of the chart.
|
* The width of the chart.
|
||||||
*/
|
*/
|
||||||
protected $width = 400;
|
protected $width = 500;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The height of the chart.
|
* The height of the chart.
|
||||||
*/
|
*/
|
||||||
protected $height = 250;
|
protected $height = 325;
|
||||||
|
|
||||||
function __construct($options = null)
|
function __construct($options = null)
|
||||||
{
|
{
|
||||||
@@ -70,6 +70,11 @@ class PMA_Chart
|
|||||||
if (isset($options['height']))
|
if (isset($options['height']))
|
||||||
$this->height = $options['height'];
|
$this->height = $options['height'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBgColorComp($component)
|
||||||
|
{
|
||||||
|
return hexdec(substr($this->bgColor, ($component * 2) + 1, 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -15,49 +15,53 @@ class PMA_pChart_Pie extends PMA_pChart_Chart
|
|||||||
require_once './libraries/chart/pChart/pChart.class';
|
require_once './libraries/chart/pChart/pChart.class';
|
||||||
|
|
||||||
// Dataset definition
|
// Dataset definition
|
||||||
$DataSet = new pData;
|
$dataSet = new pData;
|
||||||
$DataSet->AddPoint(array_values($data),"Serie1");
|
$dataSet->AddPoint(array_values($data),"Values");
|
||||||
$DataSet->AddPoint(array_keys($data),"Serie2");
|
$dataSet->AddPoint(array_keys($data),"Keys");
|
||||||
$DataSet->AddAllSeries();
|
$dataSet->AddAllSeries();
|
||||||
$DataSet->SetAbsciseLabelSerie("Serie2");
|
$dataSet->SetAbsciseLabelSerie("Keys");
|
||||||
|
|
||||||
// Initialise the graph
|
// Initialise the graph
|
||||||
$Test = new pChart($this->width, $this->height);
|
$chart = new pChart($this->width, $this->height);
|
||||||
foreach ($this->colors as $key => $color) {
|
foreach ($this->colors as $key => $color) {
|
||||||
$Test->setColorPalette(
|
$chart->setColorPalette(
|
||||||
$key,
|
$key,
|
||||||
hexdec(substr($color, 1, 2)),
|
hexdec(substr($color, 1, 2)),
|
||||||
hexdec(substr($color, 3, 2)),
|
hexdec(substr($color, 3, 2)),
|
||||||
hexdec(substr($color, 5, 2))
|
hexdec(substr($color, 5, 2))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$Test->setFontProperties($this->fontPath.'tahoma.ttf', 8);
|
$chart->setFontProperties($this->fontPath.'tahoma.ttf', 8);
|
||||||
$Test->drawFilledRoundedRectangle(
|
$chart->drawFilledRoundedRectangle(
|
||||||
$this->border1Width,
|
$this->border1Width,
|
||||||
$this->border1Width,
|
$this->border1Width,
|
||||||
$this->width - $this->border1Width,
|
$this->width - $this->border1Width,
|
||||||
$this->height - $this->border1Width,
|
$this->height - $this->border1Width,
|
||||||
5,240,240,240);
|
5,
|
||||||
$Test->drawRoundedRectangle(
|
$this->getBgColorComp(0),
|
||||||
|
$this->getBgColorComp(1),
|
||||||
|
$this->getBgColorComp(2)
|
||||||
|
);
|
||||||
|
$chart->drawRoundedRectangle(
|
||||||
$this->border1Width,
|
$this->border1Width,
|
||||||
$this->border1Width,
|
$this->border1Width,
|
||||||
$this->width - $this->border1Width,
|
$this->width - $this->border1Width,
|
||||||
$this->height - $this->border1Width,
|
$this->height - $this->border1Width,
|
||||||
5,230,230,230);
|
5,0,0,0);
|
||||||
|
|
||||||
// Draw the pie chart
|
// Draw the pie chart
|
||||||
$Test->AntialiasQuality = 0;
|
$chart->AntialiasQuality = 0;
|
||||||
$Test->setShadowProperties(2,2,200,200,200);
|
$chart->setShadowProperties(2,2,200,200,200);
|
||||||
//$Test->drawFlatPieGraphWithShadow($DataSet->GetData(),$DataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,8);
|
//$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->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);
|
$chart->drawPieGraph($dataSet->GetData(),$dataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,FALSE,60,30,10,1);
|
||||||
$Test->clearShadow();
|
$chart->clearShadow();
|
||||||
|
|
||||||
$Test->drawTitle(10,20,$titleText,0,0,0);
|
$chart->drawTitle(20,20,$titleText,0,0,0);
|
||||||
$Test->drawPieLegend(340,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
|
$chart->drawPieLegend(350,15,$dataSet->GetData(),$dataSet->GetDataDescription(),250,250,250);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
imagepng($Test->Picture);
|
imagepng($chart->Picture);
|
||||||
$output = ob_get_contents();
|
$output = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user