function generate_graph_image($outputfile) { // Create Graph Dataset and set axis attributes $graphData = new pData(); $graphData->setYAxisName($this->ytitle); $graphData->AddPoint($this->xlabels, "xaxis"); //$graphData->SetSerieName("xaxis","xaxis"); $graphData->SetAbsciseLabelSerie("xaxis"); $graphData->setXAxisName($this->xtitle); // Add each series of plot values to dataset, but Reportico will // duplicate series were the same data are displayed in different forms // so only add each unique series once $seriesadded = array(); foreach ($this->plot as $k => $v) { $series = $v["name"] . $k; $graphData->AddPoint($v["data"], $series); $graphData->SetSerieName($v["legend"], $series); $graphData->AddSerie($series); } /* switch ( $this->xgriddisplay ) { case "all": $graph->xgrid->Show(true,true); break; case "major": $graph->xgrid->Show(true,false); break; case "minor": $graph->xgrid->Show(false,true); break; case "none": default: $graph->xgrid->Show(false,false); break; } switch ( $this->ygriddisplay ) { case "all": $graph->ygrid->Show(true,true); break; case "major": $graph->ygrid->Show(true,false); break; case "minor": $graph->ygrid->Show(false,true); break; case "none": default: $graph->ygrid->Show(false,false); break; } */ /* $graph->xaxis->SetFont($fontfamilies[$xaxisfont],$fontstyles[$xaxisfontstyle], $xaxisfontsize); $graph->xaxis->SetColor($xaxiscolor,$xaxisfontcolor); $graph->yaxis->SetFont($fontfamilies[$yaxisfont],$fontstyles[$yaxisfontstyle], $yaxisfontsize); $graph->yaxis->SetColor($yaxiscolor,$yaxisfontcolor); $graph->xaxis->title->SetFont($fontfamilies[$xtitlefont],$fontstyles[$xtitlefontstyle], $xtitlefontsize); $graph->xaxis->title->SetColor($xtitlecolor); $graph->yaxis->title->SetFont($fontfamilies[$ytitlefont],$fontstyles[$ytitlefontstyle], $ytitlefontsize); $graph->yaxis->title->SetColor($ytitlecolor); $graph->xaxis->SetLabelAngle(90); $graph->xaxis->SetLabelMargin(15); $graph->yaxis->SetLabelMargin(15); $graph->xaxis->SetTickLabels($this->xlabels); $graph->xaxis->SetTextLabelInterval($xticklabint); $graph->yaxis->SetTextLabelInterval($yticklabint); $graph->xaxis->SetTextTickInterval($xtickinterval); $graph->yaxis->SetTextTickInterval($ytickinterval); */ /* if ( $gridpos == "front" ) $graph->SetGridDepth(DEPTH_FRONT); */ // Display the graph /*?$graph->Stroke();*/ $this->apply_defaults_internal(); //echo $this->width_pdf_actual.",".$this->height_pdf_actual."<BR>"; $graphImage = new pChart($this->width_pdf_actual, $this->height_pdf_actual); /* Turn of Antialiasing */ $graphImage->Antialias = TRUE; // Add gradient fill from chosen background color to white $startgradient = htmltorgb("#ffffff"); //$graphImage->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,array( //"StartR"=>$startgradient[0], "StartG"=>$startgradient[1], "StartB"=>$startgradient[2], //"EndR"=>$color[0], "EndG"=>$color[1], "EndB"=>$color[2],"Alpha"=>100)); /* Add a border to the picture */ //$graphImage->drawRectangle(0,0,$width - 1,$height - 1,200,200,200); $graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xaxisfont, $this->xaxisfontsize); /* Define the chart area */ $graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright_actual, $this->height_pdf_actual - $this->marginbottom_actual); $graphImage->drawFilledRoundedRectangle(3, 3, $this->width_pdf_actual - 3, $this->height_pdf_actual - 3, 5, 240, 240, 240); $graphImage->drawRoundedRectangle(1, 1, $this->width_pdf_actual - 1, $this->height_pdf_actual - 1, 5, 230, 230, 230); // Before plotting a series ensure they are all not drawable. /// Plot the chart data $stackeddrawn = false; $linedrawn = false; $scatterdrawn = false; $piedrawn = false; $stackedexists = false; $overlayexists = false; $barexists = false; foreach ($this->plot as $k => $v) { if ($v["type"] == "OVERLAYBAR") { $overlayexists = true; } if ($v["type"] == "STACKEDBAR") { $stackedexists = true; } if ($v["type"] == "STACKEDBAR" || $v["type"] == "BAR") { $barexists = true; } // Set plot colors if ($v["linecolor"]) { $graphImage->Palette[$k] = htmltorgb_pchart($v["linecolor"]); } $url .= "&plotlinecolor{$k}=" . $v["linecolor"]; } $scale_drawing_mode = SCALE_NORMAL; $scale_drawing_mode = SCALE_START0; // For stacked charts fix up the Max and Min values; if ($stackedexists) { $scale_drawing_mode = SCALE_ADDALL; $scaleMin = "Unknown"; $scaleMax = 0; $min = false; $max = false; foreach ($plot as $k => $v) { if ($v["type"] == "BAR" || $v["type"] == "STACKEDBAR") { $series = $v["name"] . $k; minmaxValueOfSeries($v["data"], $min, $max); if ($scaleMin == "Unknown" || $min < $scaleMin) { $scaleMin = $min; } $scaleMax = $scaleMax + $max; } } if ($scaleMin > 0) { $scaleMin = 0; } $range = $scaleMax - $scaleMin; // Make scales based on 5% of the range of values $scaleMax = round($range * 0.05 + $scaleMax); if ($scaleMin < 0) { $scaleMin = $scaleMin - round($range * 0.05); } $AxisBoundaries = array(0 => array("Min" => $scaleMin, "Max" => $scaleMax)); } else { if ($barexists || $overlayexists) { $scaleMin = "Unknown"; $scaleMax = 0; $min = false; $max = false; foreach ($this->plot as $k => $v) { if ($v["type"] == "BAR" || $v["type"] == "STACKEDBAR") { $series = $v["name"] . $k; minmaxValueOfSeries($v["data"], $min, $max); if ($scaleMin == "Unknown" || $min < $scaleMin) { $scaleMin = $min; } if ($scaleMax == "Unknown" || $max > $scaleMax) { $scaleMax = $max; } } } if ($scaleMin > 0) { $scaleMin = 0; } $range = $scaleMax - $scaleMin; // Make scales based on 5% of the range of values $scaleMax = round($range * 0.05 + $scaleMax); if ($scaleMin < 0) { $scaleMin = $scaleMin - round($range * 0.05); } $AxisBoundaries = array(0 => array("Min" => $scaleMin, "Max" => $scaleMax)); } } //echo "<PRE>"; //var_dump($graphData->GetDataDescription()); //die; // Find out if a scale is required, will be except for pie charts $scalerequired = false; foreach ($this->plot as $k => $v) { switch ($v["type"]) { case "BAR": case "STACKEDBAR": case "OVERLAYBAR": case "LINE": $scalerequired = "NORMAL"; break; case "SCATTER": $scalerequired = "SCATTER"; break; } } $graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xtitlefont, $this->xtitlefontsize); if ($scalerequired) { $graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom_actual); $graphImage->drawGraphAreaGradient(240, 240, 240, -20); // Automatic generation of x tick interval based on number of ticks if ($this->xticklabelinterval_actual == "AUTO") { $labct = count($this->plot[0]["data"]); $this->xticklabelinterval_actual = floor($labct / 35) + 1; } if ($scalerequired == "NORMAL") { $graphImage->drawScale($graphData->GetData(), $graphData->GetDataDescription(), $scale_drawing_mode, 0, 0, 0, TRUE, 40, FALSE, TRUE, $this->xticklabelinterval_actual, FALSE); } $graphImage->drawGrid(2, TRUE, 230, 230, 230, 45); } else { $this->marginright = 5; $this->marginbottom = 5; $this->marginleft = 5; $this->marginright_actual = 5; $this->marginbottom_actual = 5; $this->marginleft_actual = 5; //$this->margintop_actual = 5; $graphImage->setGraphArea($this->marginleft, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom); $graphImage->drawGraphAreaGradient(240, 240, 240, -10); } // If there's a Pie chart we want to draw different legends $piechart = false; foreach ($this->plot as $k => $v) { disableAllSeries($this->plot, $graphData); $series = $v["name"] . $k; setSerieDrawable($this->plot, $graphData, $series, TRUE); switch ($v["type"]) { case "PIE": $piedrawn = true; $piechart = true; $graphImage->drawFilledCircle($this->width_pdf_actual / 2 + 2, $this->margintop_actual + 2 + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45 + 1, 200, 200, 200); $graphImage->drawBasicPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45, PIE_PERCENTAGE_LABEL, 255, 255, 218); break; case "PIE3D": $piedrawn = true; $piechart = true; $graphImage->drawPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.5, PIE_PERCENTAGE_LABEL, true, 60, 20, 0, 0); break; case "OVERLAYBAR": case "STACKEDBAR": case "BAR": if ($stackeddrawn) { break; } if ($barexists || $overlayexists) { foreach ($this->plot as $k1 => $v1) { if ($v1["type"] == "BAR" || $v1["type"] == "STACKEDBAR" || $v1["type"] == "OVERLAYBAR") { setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE); } } } $stackeddrawn = true; if ($stackedexists) { $graphImage->drawStackedBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90); } else { if ($overlayexists) { $graphImage->drawOverlayBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90); } else { $graphImage->drawBarGraph($graphData->GetData(), $graphData->GetDataDescription()); } } break; case "SCATTER": if ($scatterdrawn) { break; } $scatterdrawn = true; $series1 = false; $series2 = false; $graphImage->reportWarnings("GD"); $ct = 0; foreach ($this->plot as $k1 => $v1) { if ($v1["type"] == "SCATTER") { if ($ct == 0) { $series1 = $v1["name"] . $k1; } if ($ct == 1) { $series2 = $v1["name"] . $k1; } $ct++; setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE); } } if (count($v["data"]) == 1) { $v["data"][] = 0; } $graphImage->drawXYScale($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2, 0, 0, 0); //$graphImage->drawXYGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2); $graphImage->drawXYPlotGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2); $graphImage->writeValues($graphData->GetData(), $graphData->GetDataDescription(), $series2); break; case "LINE": default: if ($linedrawn) { break; } $linedrawn = true; foreach ($this->plot as $k1 => $v1) { if ($v1["type"] == "LINE") { setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE); } } if (count($v["data"]) == 1) { $v["data"][] = 0; } $graphImage->LineWidth = 1; $graphImage->drawLineGraph($graphData->GetData(), $graphData->GetDataDescription()); $graphImage->drawPlotGraph($graphData->GetData(), $graphData->GetDataDescription()); $graphImage->LineWidth = 1; break; } } foreach ($this->plot as $k1 => $v1) { setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE); } // Draw Legend if legend value has been set $drawlegend = false; foreach ($this->plot as $k => $v) { if (isset($v["legend"]) && $v["legend"]) { // Temporarily Dont draw legend for Pie //if ( $piechart ) //$graphImage->drawPieLegend($this->width_pdf_actual - 180,30,$graphData->GetData(), $graphData->GetDataDescription(), 250, 250, 250); if (!$piechart) { $graphImage->drawLegend($this->width_pdf_actual - 120, 30, $graphData->GetDataDescription(), 254, 254, 254, 0, 0, 0); } break; } } $graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xtitlefont, $this->titlefontsize); $graphImage->drawTitle(0, 24, $this->title_actual, 50, 50, 50, $this->width_pdf_actual); //$graphImage->setShadow(TRUE,array("X"=>0,"Y"=>0,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); //$graphImage->Render("example.png"); //$graphImage->Stroke(); $graphImage->render($outputfile); return true; }
*/ // Standard inclusions include "pChart/pData.class"; include "pChart/pChart.class"; // Dataset definition $DataSet = new pData(); $DataSet->AddPoint(array(10, 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, 30), "Serie2"); $DataSet->AddAllSeries(); $DataSet->SetAbsciseLabelSerie(); $DataSet->SetXAxisName("Samples"); $DataSet->SetYAxisName("Temperature"); $DataSet->SetSerieName("January", "Serie1"); // Initialise the graph $Test = new pChart(700, 230); $Test->reportWarnings("GD"); $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->setGraphArea(60, 30, 585, 185); $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(), SCALE_NORMAL, 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);
public function testDrawArea() { // Dataset definition $DataSet = new pData(); $DataSet->addPoints(array(10, 9.4, 7.7, 5, 1.7, -1.7, -5, -7.7, -9.4, -10, -9.4, -7.7, -5, -1.8, 1.7), "Serie1"); $DataSet->addPoints(array(0, 3.4, 6.4, 8.699999999999999, 9.800000000000001, 9.800000000000001, 8.699999999999999, 6.4, 3.4, 0, -3.4, -6.4, -8.6, -9.800000000000001, -9.9), "Serie2"); $DataSet->addPoints(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 5.7, 2.6, -0.9, -4.2, -7.1, -9.1, -10, -9.699999999999999, -8.199999999999999, -5.8), "Serie3"); $DataSet->addPoints(array("Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Mar", "Mar", "Mar", "Apr", "Apr", "Apr", "May", "May", "May"), "Serie4"); $DataSet->AddAllSeries(); $DataSet->SetAbscissaLabelSeries("Serie4"); $DataSet->SetSeriesName("Max Average", "Serie1"); $DataSet->SetSeriesName("Min Average", "Serie2"); $DataSet->SetSeriesName("Temperature", "Serie3"); $DataSet->SetYAxisName("Temperature"); $DataSet->SetXAxisName("Month of the year"); // Initialise the graph $canvas = new TestCanvas(); $Test = new pChart(700, 230, $canvas); $Test->reportWarnings("GD"); $Test->setFixedScale(-12, 12, 5); $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->setGraphArea(65, 30, 570, 185); $canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow()); $backgroundStyle = new BackgroundStyle(new Color(255), TRUE); $Test->drawGraphBackground($backgroundStyle); $scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(150)); $Test->drawScale($DataSet, $scaleStyle, 0, 2, TRUE, 3); $Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 50)); // Draw the 0 line $Test->setFontProperties("Fonts/tahoma.ttf", 6); $Test->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE); // Draw the area $DataSet->RemoveSeries("Serie4"); $Test->drawArea($DataSet->GetData(), "Serie1", "Serie2", new Color(239, 238, 227), 50); $DataSet->RemoveSeries("Serie3"); $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription()); // Draw the line graph $Test->setLineStyle(1, 6); $DataSet->RemoveAllSeries(); $DataSet->AddSeries("Serie3"); $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription()); $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255)); // Write values on Serie3 $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3"); // Finish the graph $Test->setFontProperties("Fonts/tahoma.ttf", 8); $Test->drawLegend(590, 90, $DataSet->GetDataDescription(), new Color(255)); $Test->setFontProperties("Fonts/tahoma.ttf", 10); $Test->drawTitle(60, 22, "example 15", new Color(50), 585); // Add an image $Test->drawFromPNG(dirname(__FILE__) . "/../Sample/logo.png", 584, 35); $this->assertEquals('53b34d556af518230b7556e19349bd94', md5($canvas->getActionLog())); }
} else { if ($overlayexists) { $graphImage->drawOverlayBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90); } else { $graphImage->drawBarGraph($graphData->GetData(), $graphData->GetDataDescription()); } } break; case "SCATTER": if ($scatterdrawn) { break; } $scatterdrawn = true; $series1 = false; $series2 = false; $graphImage->reportWarnings("GD"); $ct = 0; foreach ($plot as $k1 => $v1) { if ($v1["type"] == "SCATTER") { if ($ct == 0) { $series1 = $v1["name"] . $k1; } if ($ct == 1) { $series2 = $v1["name"] . $k1; } $ct++; setSerieDrawable($plot, $graphData, $v1["name"] . $k1, TRUE); } } if (count($v["data"]) == 1) { $v["data"][] = 0;
function createChart(&$info, &$cfg) { $backgndColor = array('R' => 255, 'G' => 255, 'B' => 254); $chartCfg = new stdClass(); $chartCfg->XSize = $info->canDraw ? $cfg->XSize : 600; $chartCfg->YSize = $info->canDraw ? $cfg->YSize : 50; $chartCfg->border = new stdClass(); $chartCfg->border->width = 1; $chartCfg->border->color = array('R' => 0, 'G' => 0, 'B' => 0); $chartCfg->graphArea = new stdClass(); $chartCfg->graphArea->color = array('R' => 213, 'G' => 217, 'B' => 221); $chartCfg->graphArea->beginX = property_exists($cfg, 'beginX') ? $cfg->beginX : 40; $chartCfg->graphArea->beginY = property_exists($cfg, 'beginY') ? $cfg->beginY : 100; $chartCfg->graphArea->endX = $chartCfg->XSize - $chartCfg->graphArea->beginX; $chartCfg->graphArea->endY = $chartCfg->YSize - $chartCfg->graphArea->beginY; $chartCfg->scale = new stdClass(); // 20100914 - franciscom // After reading documentation // drawScale // Today there is four way of computing scales : // // - Getting Max & Min values per serie : ScaleMode = SCALE_NORMAL // - Like the previous one but setting the min value to 0 : ScaleMode = SCALE_START0 // - Getting the series cumulative Max & Min values : ScaleMode = SCALE_ADDALL // - Like the previous one but setting the min value to 0 : ScaleMode = SCALE_ADDALLSTART0 // // This will depends on the kind of graph you are drawing, today only the stacked bar chart // can use the SCALE_ADDALL mode. // Drawing graphs were you want to fix the min value to 0 you must use the SCALE_START0 option. // $chartCfg->scale->mode = SCALE_ADDALLSTART0; $chartCfg->scale->color = array('R' => 0, 'G' => 0, 'B' => 0); $chartCfg->scale->drawTicks = TRUE; $chartCfg->scale->angle = $cfg->scale->legendXAngle; $chartCfg->scale->decimals = 1; $chartCfg->scale->withMargin = TRUE; $chartCfg->legend = new stdClass(); $chartCfg->legend->X = $chartCfg->XSize - 80; $chartCfg->legend->Y = 15; $chartCfg->legend->color = array('R' => 236, 'G' => 238, 'B' => 240); $chartCfg->title = new stdClass(); $chartCfg->title->value = $cfg->chartTitle; $chartCfg->title->X = 2 * $chartCfg->graphArea->beginX; $chartCfg->title->Y = $chartCfg->legend->Y; $chartCfg->title->color = array('R' => 0, 'G' => 0, 'B' => 255); $Test = new pChart($chartCfg->XSize, $chartCfg->YSize); $Test->reportWarnings("GD"); $Test->drawBackground($backgndColor['R'], $backgndColor['G'], $backgndColor['B']); $Test->drawGraphArea($chartCfg->graphArea->color['R'], $chartCfg->graphArea->color['G'], $chartCfg->graphArea->color['B']); $Test->setGraphArea($chartCfg->graphArea->beginX, $chartCfg->graphArea->beginY, $chartCfg->graphArea->endX, $chartCfg->graphArea->endY); $Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size')); if ($info->canDraw) { $DataSet = new pData(); foreach ($info->chart_data as $key => $values) { $id = $key + 1; $DataSet->AddPoint($values, "Serie{$id}"); $DataSet->SetSerieName($info->series_label[$key], "Serie{$id}"); } $DataSet->AddPoint($info->xAxis->values, $info->xAxis->serieName); $DataSet->AddAllSeries(); $DataSet->RemoveSerie($info->xAxis->serieName); $DataSet->SetAbsciseLabelSerie($info->xAxis->serieName); $chartData = $DataSet->GetData(); $chartLegend = $DataSet->GetDataDescription(); foreach ($info->series_color as $key => $hexrgb) { $rgb = str_split($hexrgb, 2); $Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2])); } // $Test->setFixedScale($info->scale->minY,$info->scale->maxY,$info->scale->divisions); $Test->drawScale($chartData, $chartLegend, $chartCfg->scale->mode, $chartCfg->scale->color['R'], $chartCfg->scale->color['G'], $chartCfg->scale->color['B'], $chartCfg->scale->drawTicks, $chartCfg->scale->angle, $chartCfg->scale->decimals, $chartCfg->scale->withMargin); $Test->drawStackedBarGraph($chartData, $chartLegend, 70); // Draw the legend $Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size')); $Test->drawLegend($chartCfg->legend->X, $chartCfg->legend->Y, $chartLegend, $chartCfg->legend->color['R'], $chartCfg->legend->color['G'], $chartCfg->legend->color['B']); $Test->addBorder($chartCfg->border->width, $chartCfg->border->color['R'], $chartCfg->border->color['G'], $chartCfg->border->color['B']); } else { $chartCfg->title->value .= '/' . lang_get('no_data_available'); } $Test->drawTitle($chartCfg->title->X, $chartCfg->title->Y, $chartCfg->title->value, $chartCfg->title->color['R'], $chartCfg->title->color['G'], $chartCfg->title->color['B']); $Test->Stroke(); }