removed debug info

added check for gd library
This commit is contained in:
Martynas Mickevicius
2010-07-07 09:29:29 +03:00
parent 7958e84fff
commit d387343ee0
3 changed files with 10 additions and 26 deletions

View File

@@ -198,17 +198,10 @@
{
$this->XSize = $XSize;
$this->YSize = $YSize;
echo "before imagecreatetruecolor\n";
echo "php version:".phpversion();
var_dump(function_exists('gd_info'));
$this->Picture = imagecreatetruecolor($XSize,$YSize);
echo "before this->AllocateColor\n";
$C_White =$this->AllocateColor($this->Picture,255,255,255);
echo "before imagefilledrectangle\n";
imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
echo "before imagecolortransparent";
imagecolortransparent($this->Picture,$C_White);
echo "after imagecolortransparent";
$this->setFontProperties("tahoma.ttf",8);
}

View File

@@ -33,26 +33,26 @@ abstract class PMA_pChart_Chart extends PMA_Chart
protected function render()
{
echo "before ob_start";
ob_start();
imagepng($this->chart->Picture);
$output = ob_get_contents();
ob_end_clean();
echo "after ob_end_clean";
$this->imageEncoded = base64_encode($output);
}
public function toString()
{
$this->prepareDataSet();
echo "after neprepareDataSetw";
$this->prepareChart();
echo "after prepareChart";
$this->render();
echo "after render";
if (function_exists('gd_info')) {
$this->prepareDataSet();
$this->prepareChart();
$this->render();
return '<img id="pChartPicture1" src="data:image/png;base64,'.$this->imageEncoded.'" />';
return '<img id="pChartPicture1" src="data:image/png;base64,'.$this->imageEncoded.'" />';
}
else {
return 'Missing GD library.';
}
}
protected function getFontPath()

View File

@@ -25,9 +25,7 @@ class PMA_pChart_Pie extends PMA_pChart_Chart
protected function prepareChart()
{
// Initialise the graph
echo "before new\n";
$this->chart = new pChart($this->getWidth(), $this->getHeight());
echo "after new\n";
foreach ($this->getColors() as $key => $color) {
$this->chart->setColorPalette(
$key,
@@ -36,9 +34,7 @@ class PMA_pChart_Pie extends PMA_pChart_Chart
hexdec(substr($color, 5, 2))
);
}
echo "after palette\n";
$this->chart->setFontProperties($this->getFontPath().'tahoma.ttf', 8);
echo "after font\n";
$this->chart->drawFilledRoundedRectangle(
$this->getBorder1Width(),
$this->getBorder1Width(),
@@ -49,28 +45,23 @@ class PMA_pChart_Pie extends PMA_pChart_Chart
$this->getBgColorComp(1),
$this->getBgColorComp(2)
);
echo "after drawFilledRoundedRectangle\n";
$this->chart->drawRoundedRectangle(
$this->getBorder2Width(),
$this->getBorder2Width(),
$this->getWidth() - $this->getBorder2Width(),
$this->getHeight() - $this->getBorder2Width(),
5,0,0,0);
echo "after drawRoundedRectangle\n";
// Draw the pie chart
$this->chart->AntialiasQuality = 0;
$this->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);
$this->chart->drawPieGraph($this->dataSet->GetData(),$this->dataSet->GetDataDescription(),180,160,120,PIE_PERCENTAGE,FALSE,60,30,10,1);
echo "after drawPieGraph\n";
$this->chart->clearShadow();
$this->chart->drawTitle(20,20,$this->titleText,0,0,0);
echo "after drawTitle\n";
$this->chart->drawPieLegend(350,15,$this->dataSet->GetData(),$this->dataSet->GetDataDescription(),250,250,250);
echo "after drawPieLegend\n";
}
protected function getBorder1Width()