Example #1
1
 /**
  * Based on Example24.php
  */
 public function testXYChart()
 {
     // Dataset definition
     $DataSet = new pData();
     // Compute the points
     for ($i = 0; $i <= 360; $i = $i + 10) {
         $DataSet->addPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
         $DataSet->addPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
     }
     $DataSet->setSeriesName("Trigonometric function", "Serie1");
     $DataSet->addSeries("Serie1");
     $DataSet->addSeries("Serie2");
     $DataSet->SetXAxisName("X Axis");
     $DataSet->SetYAxisName("Y Axis");
     // Initialise the graph
     $canvas = new TestCanvas();
     $Test = new pChart(300, 300, $canvas);
     $Test->drawBackgroundGradient(new Color(0), -100);
     // Prepare the graph area
     $Test->setFontProperties("Fonts/tahoma.ttf", 8);
     $Test->setGraphArea(55, 30, 270, 230);
     $scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(213, 217, 221));
     $Test->drawXYScale($DataSet, $scaleStyle, "Serie1", "Serie2", 45);
     $backgroundStyle = new BackgroundStyle(new Color(213, 217, 221), FALSE, new Color(30), -50);
     $Test->drawGraphBackground($backgroundStyle);
     $Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 20));
     // Draw the chart
     $Test->setShadowProperties(2, 2, new Color(0), 60, 4);
     $Test->drawXYGraph($DataSet->GetData(), "Serie1", "Serie2", 0);
     $Test->clearShadow();
     // Draw the title
     $Title = "Drawing X versus Y charts trigonometric functions  ";
     $Test->drawTextBox(new Point(0, 280), new Point(300, 300), $Title, 0, new Color(255), ALIGN_RIGHT, ShadowProperties::FromSettings(1, 1, new Color(0), 100, 0), new Color(0), 30);
     // Draw the legend
     $Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
     $DataSet->removeSeries("Serie2");
     $Test->drawLegend(160, 5, $DataSet->GetDataDescription(), new Color(0), new Color(0), new Color(255), FALSE);
     file_put_contents(dirname(__FILE__) . '/action_logs/testXYChart', $canvas->getActionLog());
     $this->assertEquals('3c45517b3d9549198ffffaac276ad353', md5($canvas->getActionLog()));
 }
Example #2
0
 function pie($valores, $label, $titulo)
 {
     $nombre = tempnam('/tmp', 'g') . '.png';
     $DataSet = new pData();
     $DataSet->AddPoint($valores, 'Serie1');
     $DataSet->AddPoint($label, 'Serie2');
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie('Serie2');
     $Test = new pChart(300, 200);
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
     $Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
     $Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
     $Test->AntialiasQuality = 0;
     $Test->setShadowProperties(2, 2, 200, 200, 200);
     $Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 110, 60, PIE_PERCENTAGE, 8);
     $Test->clearShadow();
     $Test->drawPieLegend(210, 30, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
     $Test->drawTitle(10, 22, $titulo, 50, 50, 50, 300);
     $Test->Render($nombre);
     return $nombre;
 }
$DataSet->SetYAxisName("Amount Used (kg)");
$DataSet->SetXAxisName("Month of the year");
// Initialise the graph
$Test = new pChart(660, 230);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 40, 595, 190);
// Initialise graph area
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
// Draw the SourceForge Rank graph
$DataSet->SetYAxisName("Amount of Fuel Used");
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 0);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Clear the scale
$Test->clearScale();
// Draw the 2nd graph
/*$DataSet->RemoveSerie("Serie1");  
 $DataSet->AddSerie("Serie2");  
 $DataSet->SetYAxisName("Web Hits");  
 $Test->drawRightScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,213,217,221,TRUE,0,0);  
 $Test->drawGrid(4,TRUE,230,230,230,10);  
 $Test->setShadowProperties(3,3,0,0,0,30,4);  
 $Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());  
 $Test->clearShadow();  
Example #4
0
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 5);
// Draw the title
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Title = "  Average growth size for selected\r\n  DNA samples  ";
$Test->setLineStyle(2);
$Test->drawLine(51, -2, 51, 402, 0, 0, 0);
$Test->setLineStyle(1);
$Test->drawTextBox(0, 0, 50, 400, $Title, 90, 255, 255, 255, ALIGN_BOTTOM_CENTER, TRUE, 0, 0, 0, 30);
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Second chart
$DataSet->SetXAxisName("");
$Test->clearScale();
$Test->setGraphArea(110, 20, 350, 140);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 213, 217, 221, TRUE, 0, 2);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 5);
// Draw the line chart
$Test->setShadowProperties(0, 3, 0, 0, 0, 30, 4);
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 40);
$Test->clearShadow();
// Write the legend
$Test->drawLegend(-2, 3, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, 255, 255, 255, FALSE);
// Finish the graph
$Test->addBorder(1);
$Test->Render("HomePage2.png");
/*
 Example13: A 2D exploded pie graph
*/
// Standard inclusions
require_once "../pChart/pData.class";
require_once "../pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$data = array(10, 12, 13);
$sum = array_sum($data);
$DataSet->AddPoint(array(10, 12, 13), "Serie1");
$DataSet->AddPoint(array("Charcoal", "Firewood", "Kerosene"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(420, 250);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
//$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
// Draw the pie chart
$Test->AntialiasQuality = 0;
$Test->setShadowProperties(2, 2, 200, 200, 200);
//$Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 150,130,90, PIE_PERCENTAGE, 8);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 130, 90, PIE_PERCENTAGE, 8);
$Test->clearShadow();
$Test->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->setFontProperties("../Fonts/tahoma.ttf", 13);
$Test->drawTitle(10, 20, "Fuel Usage in 2015", 114, 16, 46);
$Test->drawTitle(320, 220, 'Total :' . $sum . 'kg', 224, 46, 147);
$Test->Render("fuel.png");
} else {
    $DataSet = new pData();
    $DataSet->AddPoint($skill, 'SerieSkill');
    $DataSet->AddPoint($skill_change, 'SerieSession');
    $DataSet->AddPoint($date, 'SerieDate');
    $DataSet->AddSerie('SerieSkill');
    $DataSet->SetAbsciseLabelSerie('SerieDate');
    $DataSet->SetSerieName('Skill', 'SerieSkill');
    $DataSet->SetSerieName('Session', 'SerieSession');
    $Chart->setFontProperties(IMAGE_PATH . '/sig/font/DejaVuSans.ttf', 7);
    $DataSet->SetYAxisName('Skill');
    $DataSet->SetYAxisUnit('K');
    $Chart->setColorPalette(0, 255, 255, 0);
    $Chart->drawRightScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
    $Chart->drawGrid(1, FALSE, 55, 55, 55, 100);
    $Chart->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
    $Chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    $Chart->clearShadow();
    $Chart->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
    $Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 1, 1, 255, 255, 255);
    $Chart->clearScale();
    $DataSet->RemoveSerie('SerieSkill');
    $DataSet->AddSerie('SerieSession');
    $DataSet->SetYAxisName('Session');
    $DataSet->SetYAxisUnit('');
    $Chart->setColorPalette(1, 255, 0, 0);
    $Chart->setColorPalette(2, 0, 0, 255);
    $Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
    $Chart->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
    $Chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    $Chart->clearShadow();
Example #7
0
//---------------------------- Set GraphArea
$Test->setGraphArea(0, 0, $w, $h);
//---------------------------- Set background graphics (R,G,G,1/Y)
if ($bg_r != 0 && $bg_g != 0 && $bg_b != 0) {
    $Test->drawGraphAreaGradient($bg_r, $bg_g, $bg_b, 5);
}
//---------------------------- Calc center
$midX = $w / 2;
$midY = $h / 2;
//---------------------------- Draw pie
if ($_GET['gtype'] == 'pie') {
    $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, $cbg, $cbg, $cbg, 1);
} elseif ($_GET['gtype'] == 'pie2') {
    $Test->drawFlatPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie3') {
    $Test->setShadowProperties(3, 3, $csh, $csh, $csh, 90);
    $Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie4') {
    $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, TRUE, 60, 20, 5, 1);
} else {
    //
}
//---------------------------- Border
if ($_GET['border'] == '1') {
    $Test->AddBorder(1, 200, 200, 200);
}
//---------------------------- Image PNG
Header("Content-type:image/png");
imagepng($Test->Picture);
//$Test->Render();
//---------------------------- Disconnect
Example #8
0
$pChartDataSet->RemoveSerie("Serie1");
$pChartDataSet->SetAbsciseLabelSerie("Serie1");
$pChartDataSet->SetYAxisName("在\n线\n人\n数\n//\n人");
$pChartDataSet->SetYAxisFormat("floor");
$pChartDataSet->SetXAxisFormat("number");
// 设置作图区域
$pChartGraph = new pChart($imgWidth, 253);
$pChartGraph->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
$pChartGraph->setGraphArea(70, 30, $imgWidth + 70 - 90, 253 + 30 - 80);
$pChartGraph->setFontProperties(DRAWFONE_PATH, 8);
$pChartGraph->drawScale($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), SCALE_NORMAL, 250, 250, 250, TRUE, 0, 0, FALSE, 1);
// 开始作图
$pChartGraph->setColorPalette(0, 0, 255, 255);
$pChartGraph->drawGraphAreaGradient(40, 40, 40, -50);
$pChartGraph->drawGrid(1, TRUE, 115, 115, 115, 10);
$pChartGraph->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$pChartGraph->drawFilledLineGraph($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), 25);
$pChartGraph->clearShadow();
$pChartGraph->setFontProperties(DRAWFONE_PATH, 10);
$pChartGraph->drawTitle($imgWidth / 2, 22, "实时在线人数查询(" . $dateTime . ") 峰值( " . $maxNumberIndex . ", " . $maxNumber . "人 )", 255, 255, 255, 585);
$pChartGraph->writeValues($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), "Serie2");
// 结束
$pChartGraph->Stroke();
//	$pChartGraph->Render("RealTimeOnLine.png");
//	echo "<img src = 'RealTimeOnLine.png'>";
//	$fileNameTxt = "Cache/XYInfo.".$plat.$server.$dateTime.".txt";
//	$file = fopen($fileNameTxt,"w");
//	$info = $pChartGraph->DivisionWidth.",".$pChartGraph->GArea_Y2.",".$pChartGraph->VMin.",".$pChartGraph->DivisionRatio;
//	fwrite($file,$info);
//	fclose($file);
?>
Example #9
-1
for ($i = 0; $i <= 360; $i = $i + 10) {
    $DataSet->AddPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
    $DataSet->AddPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
}
$DataSet->SetSerieName("Trigonometric function", "Serie1");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetXAxisName("X Axis");
$DataSet->SetYAxisName("Y Axis");
// Initialise the graph
$Test = new pChart(300, 300);
$Test->drawGraphAreaGradient(0, 0, 0, -100, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 270, 230);
$Test->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 213, 217, 221, TRUE, 45);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawGraphAreaGradient(30, 30, 30, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the chart
$Test->setShadowProperties(2, 2, 0, 0, 0, 60, 4);
$Test->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 0);
$Test->clearShadow();
// Draw the title
$Title = "Drawing X versus Y charts trigonometric functions  ";
$Test->drawTextBox(0, 280, 300, 300, $Title, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
// Draw the legend
$Test->setFontProperties("Fonts/pf_arma_five.ttf", 6);
$DataSet->RemoveSerie("Serie2");
$Test->drawLegend(160, 5, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, 255, 255, 255, FALSE);
$Test->Stroke("example24.png");
Example #10
-1
 function cartesianChart($type, $x, $y, $w, $h, $imgname = '', $config = array())
 {
     $w -= 4;
     $h -= 4;
     $settings = array('FontName' => 'tahoma.ttf', 'FontSize' => 8, 'LegendFontSize' => 8, 'LegendFontName' => 'tahoma.ttf', 'Logo' => '', 'LogoTransparency' => 20, 'XAxisFormat' => 'number', 'XAxisUnit' => '', 'YAxisFormat' => 'number', 'YAxisUnit' => '', 'XLogo' => 0, 'YLogo' => 0, 'Xlabel' => 'x label', 'XAngle' => 0, 'Ylabel' => 'y label', 'Legend' => '', 'Textbox' => '', 'TextboxFontSize' => 8, 'TextboxFontName' => 'tahoma.ttf', 'ImgR' => 132, 'ImgG' => 173, 'ImgB' => 131, 'Decay' => 80, 'BGR' => 163, 'BGG' => 203, 'BGB' => 167, 'Decay2' => 80, 'Filled' => '', 'DataR' => 191, 'DataG' => 120, 'DataB' => 71, 'LBR' => 226, 'LBG' => 228, 'LBB' => 230, 'LR' => 0, 'LG' => 0, 'LB' => 0);
     // Get the custom settings
     if (is_array($config)) {
         foreach ($config as $key => $val) {
             $settings[$key] = $val;
         }
     }
     $DataSet = new pData();
     $DataSet->AddPoint($y, "Serie1");
     $DataSet->AddPoint($x, "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->RemoveSerie("Serie2");
     $DataSet->SetAbsciseLabelSerie("Serie2");
     $DataSet->SetSerieName($settings['Legend'], "Serie1");
     $DataSet->SetYAxisName($settings['Ylabel']);
     $DataSet->SetXAxisName($settings['Xlabel']);
     $DataSet->SetXAxisFormat($settings['XAxisFormat']);
     if (strlen($settings['XAxisUnit'])) {
         $DataSet->SetXAxisUnit($settings['XAxisUnit']);
     }
     if (strlen($settings['YAxisUnit'])) {
         $DataSet->SetYAxisUnit($settings['YAxisUnit']);
     }
     $DataSet->SetYAxisFormat($settings['YAxisFormat']);
     // Initialise the graph
     $Test = new pChart($w, $h);
     $Test->drawGraphAreaGradient($settings['ImgR'], $settings['ImgG'], $settings['ImgB'], $settings['Decay'], TARGET_BACKGROUND);
     $FontSize = $settings['FontSize'];
     $FontName = $this->_ext_path . "/fonts/" . $settings['FontName'];
     $Test->setFontProperties($FontName, $FontSize);
     //Calc Textbox Height
     if (strlen($settings['Textbox'])) {
         $TextboxFontSize = $settings['TextboxFontSize'];
         $TextboxFontName = $this->_ext_path . "/fonts/" . $settings['TextboxFontName'];
         $Position = imageftbbox($TextboxFontSize, 0, $TextboxFontName, $settings['Textbox']);
         $TextboxHeight = $Position[1] - $Position[7] + 8;
     } else {
         $TextboxHeight = 0;
     }
     // Maximize The graph area
     //on Y axis
     if ($settings['XAxisFormat'] == 'time') {
         $xdata = "99:99:99";
         $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
         $WXmax = $Position[2] - $Position[0];
         $TextHeightX = $Position[1] - $Position[7];
     } elseif ($settings['XAxisFormat'] == 'date') {
         $xdata = "99/99/9999";
         $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
         $WXmax = $Position[2] - $Position[0];
         $TextHeightX = $Position[1] - $Position[7];
     } else {
         $WXmax = 0;
         foreach ($x as $xdata) {
             $xdata .= $settings['XAxisUnit'];
             $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
             $TextWidth = $Position[2] - $Position[0];
             $TextHeightX = $Position[1] - $Position[7];
             $WXmax = $TextWidth > $WXmax ? $TextWidth : $WXmax;
         }
     }
     if ($settings['XAngle'] > 0) {
         $sin = abs(sin(deg2rad($settings['XAngle'])));
         $cos = abs(cos(deg2rad($settings['XAngle'])));
         $HXmax = $WXmax * $sin + $TextHeightX * $cos;
     } else {
         $HXmax = $TextHeightX;
     }
     //on Y axis...
     if ($settings['YAxisFormat'] == 'time') {
         $ydata = "99:99:99";
         $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
         $WYmax = $Position[2] - $Position[0];
         $TextHeightY = $Position[1] - $Position[7];
     } elseif ($settings['YAxisFormat'] == 'date') {
         $ydata = "99/99/9999";
         $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
         $WYmax = $Position[2] - $Position[0];
         $TextHeightY = $Position[1] - $Position[7];
     } else {
         $WYmax = 0;
         foreach ($y as $ydata) {
             $ydata .= $settings['YAxisUnit'];
             //echo $ydata."<br>";
             $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
             $TextWidth = $Position[2] - $Position[0];
             $TextHeightY = $Position[1] - $Position[7];
             $WYmax = $TextWidth > $WYmax ? $TextWidth : $WYmax;
         }
     }
     $Test->setGraphArea($WYmax + $TextHeightY + 35, 20, $w - 25, $h - $HXmax - $TextHeightX - $TextboxHeight - 20);
     //$Test->setGraphArea(60,20,$w-25,($settings['XAngle']==0)?$h-70:$h-100);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, $settings['XAngle'], 0, TRUE);
     $Test->drawGraphAreaGradient($settings['BGR'], $settings['BGG'], $settings['BGB'], $settings['Decay2']);
     $Test->drawGrid(4, TRUE, 230, 230, 230, 20);
     // This will put the picture "logo.png" with transparency
     if (strlen($settings['Logo'])) {
         $XLogo = $WYmax + $TextHeightY + 35 + $settings['XLogo'];
         $YLogo = 20 + $settings['XLogo'];
         $logo = $settings['Logo'];
         //Fing extension of logo : png,gif or jpg
         if ($this->_findexts($logo) == "png") {
             echo "png!";
             $Test->drawFromPNG($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
         } elseif ($this->_findexts($logo) == "gif") {
             echo "gif!";
             $Test->drawFromGIF($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
         } elseif ($this->_findexts($logo) == "jpg") {
             echo "jpg";
             $Test->drawFromJPG($logo, $XLogo, $YLogo, $settings['LogoTransparency']);
         }
     }
     $Test->setColorPalette(0, $settings['DataR'], $settings['DataG'], $settings['DataB']);
     if ($type == "bar") {
         // Draw the bar chart
         $Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
     } elseif ($type == "line") {
         $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
         $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 0, -1, -1, -1, TRUE);
     } elseif ($type == "cubic") {
         $Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
         $Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
         $Test->clearShadow();
         if ($settings['Filled'] == 'yes') {
             $Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
         }
         $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 0, -1, -1, -1, TRUE);
     }
     // Draw the textbox
     if (strlen($settings['Textbox'])) {
         $Test->setFontProperties($TextboxFontName, $TextboxFontSize);
         $Test->drawTextBox(0, $h - $TextboxHeight, $w, $h, $settings['Textbox'], 0, 255, 255, 255, ALIGN_CENTER, TRUE, 0, 0, 0, 30);
     }
     // Draw the legend
     if (strlen($settings['Legend'])) {
         $LegendFontSize = $settings['LegendFontSize'];
         $LegendFontName = $this->_ext_path . "/fonts/" . $settings['LegendFontName'];
         $Position = imageftbbox($LegendFontSize, 0, $LegendFontName, $settings['Legend']);
         $LegendW = $Position[2] - $Position[0] + 40;
         $Test->setFontProperties($LegendFontName, $LegendFontSize);
         $Test->drawLegend($w - $LegendW, 10, $DataSet->GetDataDescription(), $settings['LBR'], $settings['LBG'], $settings['LBB'], 52, 58, 82, $settings['LR'], $settings['LG'], $settings['LB'], TRUE);
     }
     // Render the picture
     $Test->addBorder(2);
     if (strlen($imgname)) {
         //custom image name
         $imgname = $this->_img_path . "/" . $imgname;
     } else {
         $this->obj->load->helper('string');
         $imgname = $this->_img_path . "/{$type}-" . random_string('alnum', 16) . ".png";
     }
     $Test->Render($imgname);
     return array("name" => '/' . $imgname, "w" => $w + 4, "h" => $h + 4);
 }