/** * Рисует график по переданным данным * * @param array $points * @return string путь к файлу графика */ private function draw(array $points) { $errLevel = error_reporting(); error_reporting(0); $newsList = $this->dataProvider->getNewsList(); $classLoader = new CPChart(); $DataSet = new pData(); foreach ($points as $news_id => $set) { $DataSet->AddPoint($set, "news" . $news_id); $DataSet->SetSerieName($newsList[$news_id], "news" . $news_id); } $DataSet->AddAllSeries(); $DataSet->AddPoint(array_values($this->dataProvider->getDates()), "dates"); $DataSet->SetAbsciseLabelSerie('dates'); // Initialise the graph $chart = new pChart(700, 250); $chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 7); $chart->setGraphArea(60, 30, 570, 200); $chart->drawFilledRoundedRectangle(7, 7, 693, 253, 5, 240, 240, 240); $chart->drawRoundedRectangle(5, 5, 695, 255, 5, 230, 230, 230); $chart->drawGraphArea(255, 255, 255, true); $data = $DataSet->GetData(); if (!empty($data)) { $chart->drawScale($data, $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2, true, 3); $chart->drawGrid(4, true, 230, 230, 230, 50); $chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription()); // Finish the graph $chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 8); $chart->drawLegend(590, 20, $DataSet->GetDataDescription(), 255, 255, 255); } // Restore reporting level error_reporting($errLevel); return $this->render($chart, $points); }
/** * Генерация графика * @param DataSet $DataSet * @param String $GraphTitle * @param String $safeToFile */ function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat) { // Rotrate $rotate = 30; // Initialise the graph $GraphImage = new pChart(594, 344); $GraphImage->setDateFormat($scaleFormat); // $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt'); $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8); $GraphImage->setGraphArea(80, 50, 580, 300); $GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240); $GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230); $GraphImage->drawGraphArea(255, 255, 255, TRUE); $GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE); $GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50); // Draw the 0 line $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6); $GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE); // Просто пунктирная линия // Draw the cubic curve graph $GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription()); // Draw the line graph //$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription()); $GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255); // Finish the graph $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12); $GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600); //$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png'); $GraphImage->Stroke(); }
function line($valores, $titulo, $label = array()) { $nombre = tempnam('/tmp', 'g') . '.png'; $DataSet = new pData(); $ind = 1; $DataSet->AddPoint($valores, 'Serie' . $ind); $DataSet->AddAllSeries(); $DataSet->SetAbsciseLabelSerie(); $DataSet->SetSerieName($titulo, 'Serie' . $ind); if (count($label) > 0) { $ID = 0; foreach ($label as $val) { $DataSet->Data[$ID]["Name"] = $val; $ID++; } } $Test = new pChart(300, 200); $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8); $Test->setGraphArea(70, 30, 280, 170); $Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240); $Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230); $Test->drawGraphArea(255, 255, 255, TRUE); $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 0); $Test->drawGrid(4, TRUE, 200, 200, 200, 50); $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 6); $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE); $Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription()); $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8); $Test->drawLegend(200, 9, $DataSet->GetDataDescription(), 255, 255, 255); $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 10); //$Test->drawTitle(10,22,$titulo,50,50,50,300); $Test->Render($nombre); return $nombre; }
$DataSet->AddPoint(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1"); $DataSet->AddPoint(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2"); $DataSet->AddAllSeries(); $DataSet->SetAbsciseLabelSerie(); $DataSet->SetSerieName("January", "Serie1"); $DataSet->SetSerieName("February", "Serie2"); // Cache definition $Cache = new pCache(); $Cache->GetFromCache("Graph1", $DataSet->GetData()); // Initialise the graph $Test = new pChart(700, 230); $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->setGraphArea(50, 30, 585, 200); $Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240); $Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230); $Test->drawGraphArea(255, 255, 255, TRUE); $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), 5, 150, 150, 150, TRUE, 0, 2); $Test->drawGrid(4, TRUE, 230, 230, 230, 50); // Draw the 0 line $Test->setFontProperties("Fonts/tahoma.ttf", 6); $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE); // Draw the cubic curve graph $Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription()); // Finish the graph $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255); $Test->setFontProperties("Fonts/tahoma.ttf", 10); $Test->drawTitle(50, 22, "Example 1", 50, 50, 50, 585); // Render the graph $Cache->WriteToCache("Graph1", $DataSet->GetData(), $Test); $Test->Render("example1.png");
// Dataset $DataSet->AddPoints(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1"); $DataSet->AddPoints(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2"); $DataSet->AddAllSeries(); $DataSet->SetAbscissaLabelSeries(); $DataSet->SetSeriesName("January", "Serie1"); $DataSet->SetSeriesName("February", "Serie2"); // Cache definition $Cache = new pCache(); $Cache->GetFromCache("Example11", $DataSet->GetData()); // Initialise the graph $Chart->setFontProperties("../Fonts/tahoma.ttf", 8); $Chart->setGraphArea(50, 30, 585, 200); $Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2); $Chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 50)); // Draw the 0 line $Chart->setFontProperties("../Fonts/tahoma.ttf", 6); $Chart->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE); // Draw the cubic curve graph $Chart->drawCubicCurve($DataSet, 0.1, "Serie1"); $Chart->drawCubicCurve($DataSet, 0.1, "Serie2"); // Finish the graph $Chart->setFontProperties("../Fonts/tahoma.ttf", 8); $Chart->drawLegend(600, 30, $DataSet->GetDataDescription(), new Color(255)); $Chart->setFontProperties("../Fonts/tahoma.ttf", 10); $Chart->drawTitle(50, 22, "Example 1", new Color(50), 585); // Render the graph $Cache->WriteToCache("Example11", $DataSet->GetData(), $Chart); $Chart->Render("Example11.png"); header("Content-Type:image/png"); readfile("Example11.png");
public function componentLineGraph() { $DataSet = new pData(); $maxvals = array(); foreach ($this->datasets as $ds_id => $dataset) { $DataSet->AddPoint($dataset['values'], "Serie" . $ds_id, array_keys($dataset['values'])); $maxvals[] = max($dataset['values']); if (isset($dataset['burndown'])) { $amount = count($dataset['values']) > 1 ? $dataset['burndown']['maxEstimation'] / (count($dataset['values']) - 1) : 0; for ($i = 0; $i < count($dataset['values']); $i++) { $burndownValues[] = $dataset['burndown']['maxEstimation'] - $i * $amount; } $DataSet->AddPoint($burndownValues, "Burndown" . $ds_id, $dataset['burndown']['maxEstimation']); } } $DataSet->AddAllSeries(); if (isset($this->labels)) { $DataSet->AddPoint($this->labels, "Labels"); $DataSet->SetAbsciseLabelSerie("Labels"); } else { $DataSet->SetAbsciseLabelSerie(); } foreach ($this->datasets as $ds_id => $dataset) { $DataSet->SetSerieName($dataset['label'], "Serie" . $ds_id); if (isset($dataset['burndown'])) { $DataSet->SetSerieName($dataset['burndown']['label'], "Burndown" . $ds_id); } } if (isset($this->values_title)) { $DataSet->SetYAxisName($this->values_title); } if (isset($this->labels_title)) { $DataSet->SetXAxisName($this->labels_title); } // Initialise the graph $Test = new pChart($this->width, $this->height); $Test->setFixedScale(0, ceil(max($maxvals) / 5) * 5); $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8); if (isset($this->labels_title)) { $Test->setGraphArea(50, 30, $this->width - 30, $this->height - 45); } else { $Test->setGraphArea(50, 30, $this->width - 30, $this->height - 30); } $Test->drawFilledRoundedRectangle(2, 2, $this->width - 3, $this->height - 3, 5, 240, 240, 240); $Test->drawRoundedRectangle(0, 0, $this->width - 1, $this->height - 1, 5, 230, 230, 230); $Test->drawGraphArea(255, 255, 255, TRUE); $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2); $Test->drawGrid(4, TRUE, 230, 230, 230, 50); // Draw the 0 line $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 6); $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE); // Draw the cubic curve graph if (isset($this->style) && $this->style == 'curved') { $Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription()); } elseif (isset($this->style) && $this->style == 'filled_line') { $Test->drawFilledLineGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true); } elseif (isset($this->style) && $this->style == 'stacked_bar') { $Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true); } elseif (isset($this->style) && $this->style == 'single_bar') { $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE); } else { $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription()); } if (isset($this->include_plotter) && $this->include_plotter) { $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255); } // Finish the graph $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8); //$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255); $Test->drawLegend(55, 35, $DataSet->GetDataDescription(), 255, 255, 255); $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', 10); $Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30); $Test->Stroke(); //("example2.png"); }
/** * Draw line style chart * @return unknown */ protected function drawLine() { // prepare font & series $this->_prepareSerie(); $this->_prepareFont(); // init chart params $outer_w = $this->w - 5; // Outer frame witdh $outer_h = $this->h - 5; // Outer frame heigth $inner_w = $this->w - 7; // Inner frame witdh $inner_h = $this->h - 7; // Inner frame heigth $chart_w = $this->w - 150; // Chart frame witdh $chart_h = $this->h - 40; // Chart frame heigth $title_w = $this->w - 200; // Title width $title_h = 45; // Title height $legend_w = $chart_w + 30; // Legend width $legend_h = 40; // Legend height // chart styles $grid = isset($this->p['grid']) ? $this->p['grid'] : false; $plot = isset($this->p['plot']) ? $this->p['plot'] : false; $curve = isset($this->p['curve']) ? $this->p['curve'] : false; $filled = isset($this->p['filled']) ? $this->p['filled'] : false; // fill chart $this->chart->drawBackground(255, 255, 255); $this->chart->setFontProperties($this->font, 7); // set font and size $this->chart->drawRoundedRectangle(5, 5, $outer_w, $outer_h, 10, 230, 230, 230); // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B) $this->chart->drawFilledRoundedRectangle(7, 7, $inner_w, $inner_h, 10, 240, 240, 240); // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B) $this->chart->setGraphArea(70, 40, $chart_w, $chart_h); // setGraphArea($X1,$Y1,$X2,$Y2) $this->chart->drawGraphArea(255, 255, 255, TRUE); // drawGraphArea($R,$G,$B) $this->chart->drawScale($this->data->GetData(), $this->data->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, $this->margin, $this->skip); // drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE) $this->data->RemoveSerie('DEFAULT_SCALE'); // clear scale serie for setScale method // draw grid if ($grid) { $this->chart->drawGrid(3, TRUE, 230, 230, 230, 50); // drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=255) } // draw the 0 line //$this->chart->setFontProperties($this->font,6); //$this->chart->drawTreshold(0,143,55,72,TRUE,TRUE); // draw the cubic curve graph if ($curve) { $this->chart->drawCubicCurve($this->data->GetData(), $this->data->GetDataDescription()); if ($filled) { $this->chart->drawFilledCubicCurve($this->data->GetData(), $this->data->GetDataDescription(), 0.1, 50); // filled cubic curve graph } // draw the line graph } else { $this->chart->drawLineGraph($this->data->GetData(), $this->data->GetDataDescription()); if ($filled) { $this->chart->drawFilledLineGraph($this->data->GetData(), $this->data->GetDataDescription(), 50); } } // plot style point if ($plot) { $this->chart->drawPlotGraph($this->data->GetData(), $this->data->GetDataDescription(), 3, 2, 255, 255, 255, true); // drawPlotGraph(&$Data,&$DataDescription,$BigRadius=5,$SmallRadius=2,$R2=-1,$G2=-1,$B2=-1,$Shadow=FALSE) } // add Title $this->chart->setFontProperties($this->font, 10); $this->chart->drawTitle(40, 0, $this->title, 50, 50, 50, $title_w, $title_h); // drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE) // add Legend $this->chart->setFontProperties($this->font, 8); $this->chart->drawLegend($legend_w, $legend_h, $this->data->GetDataDescription(), 255, 255, 255); // drawLegend($description,$R,$G,$B) }
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); }