-
jpl
-
-
OFFLINE
-
Fresh Boarder
-
- Posts: 2
-
-
|
Hi guys,
I have installed the pChart library in order to insert a chart into my generated PDF. This works, but I want the values of the bars in the chart to have the values from dropdown fields from RS!Forms Pro. How can I call these values in the script below? The name of the RS!Forms Pro field are {point1:value}, {point2:value} to {point10:value}. They should replace the ten values on line 8.
include("libraries/pChart/class/pData.class.php");
include("libraries/pChart/class/pDraw.class.php");
include("libraries/pChart/class/pImage.class.php");
header('Content-type: image/jpeg');
$myData = new pData();
$myData->addPoints(array(100,20,40,10,90,50,80,90,90,90),"Serie1"); //This is where the values should be replaced by {point1:value},{point2:value}...{point10:value}.
$myData->setSerieDescription("Serie1","Serie 1");
$myData->setSerieOnAxis("Serie1",0);
$myData->addPoints(array(1,2,3,4,5,6,7,8,9,10),"Absissa");
$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0,AXIS_POSITION_LEFT);
$myData->setAxisName(0,"KIWI POINT");
$myData->setAxisUnit(0,"");
$myPicture = new pImage(327,154,$myData);
//$myPicture->drawRectangle(0,0,326,153,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>20));
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(35,20,310,129);
$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"libraries/pChart/fonts/pf_arma_five.ttf","FontSize"=>6));
$Settings = array("Pos"=>SCALE_POS_LEFTRIGHT
, "Mode"=>SCALE_MODE_MANUAL, "ManualScale"=>array(0=>array("Min"=>0,"Max"=>100))
, "LabelingMethod"=>LABELING_ALL
, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0, "TickG"=>0, "TickB"=>0, "TickAlpha"=>50, "LabelRotation"=>0, "CycleBackground"=>1, "DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255, "SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50, "DrawYLines"=>ALL);
$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>10));
$Config = array("Gradient"=>1, "AroundZero"=>1);
$myPicture->drawBarChart($Config);
$myPicture->render("images/chart.png");
$image = imagecreatefrompng('images/chart.png');
imagejpeg($image, 'images/chart.jpg', 100);
A huge thank you in advance, guys! Your help is much appreciated
|