Example #1
0
//$myPicture->drawFilledRectangle(0,0,1024,400,array("R"=>47,"G"=>126,"B"=>216,"Surrounding"=>-200,"Alpha"=>80));
/* Write the chart title */
$Settings = array("R" => 179, "G" => 217, "B" => 91, "Dash" => 1, "DashR" => 199, "DashG" => 237, "DashB" => 111);
$myPicture->drawFilledRectangle(0, 0, $W, 400, $Settings);
$Settings = array("StartR" => 194, "StartG" => 231, "StartB" => 44, "EndR" => 43, "EndG" => 107, "EndB" => 58, "Alpha" => 50);
$myPicture->drawGradientArea(60, 40, $W - 20, 380, DIRECTION_VERTICAL, $Settings);
//$myPicture->drawGradientArea(60,40,1010,380,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
$myPicture->setFontProperties(array("FontName" => "pChart/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "pChart/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, $W - 20, 380);
/* Draw the scale */
$scaleSettings = array("LabelSkip" => round(count($data1) / 10), "DrawXLines" => TRUE, "XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$myPicture->drawsplineChart();
$myPicture->drawPlotChart();
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_BOX, "Mode" => LEGEND_HORIZONTAL));
//$myPicture->drawScale(array("AutoAxisLabels"=>TRUE,"Pos"=>SCALE_POS_TOPBOTTOM));
/* Render the picture (choose the best way) */
// $myPicture->autoOutput("simple2.png");
ob_start();
imagepng($myPicture->Picture);
$contents = ob_get_contents();
ob_end_clean();
print "<img src='data:image/png;base64," . base64_encode($contents) . "' />\n";