Again, short post. This php code:
<?php
session_start();
require_once "/srv/www/lib/pChart/class/pDraw.class.php";
require_once "/srv/www/lib/pChart/class/pImage.class.php";
require_once "/srv/www/lib/pChart/class/pData.class.php";
$squareSeries = array();
$cubeSeries = array();
$fourthSeries = array();
for ($i = 0; $i <= 4; $i++){ $squareSeries[$i] = pow($i,2); $cubeSeries[$i] = pow($i,3); $fourthSeries[$i] = pow($i, 4); } $myPowersData = new pData(); $myPowersData -> addPoints($squareSeries,"Square");
$myPowersData -> addPoints($cubeSeries,"Cube");
$myPowersData -> addPoints($fourthSeries,"Fourth");
$myPowersData-> setPalette("Square",
array("R" => 240, "G" => 16, "B" => 16, "Alpha" => 100));
$myPowersData-> setPalette("Cube",
array("R" => 16, "G" => 240, "B" => 16, "Alpha" => 100));
$myPowersData-> setPalette("Forth",
array("R" => 16, "G" => 16, "B" => 240, "Alpha" => 100));
$myPowersImage = new pImage(500,300, $myPowersData);
$myPowersImage -> setFontProperties(array(
"FontName" => "/srv/www/lib/pChart/fonts/verdana.ttf",
"FontSize" => 12));
$myPowersImage->setGraphArea(40,40, 460,260);
$myPowersImage->drawScale();
$myPowersImage->drawLineChart();
header("Content-Type: image/png");
$myPowersImage->Render(null);
I learned this using this resource:
http://phpmaster.com/charting-with-pchart/

