View unanswered posts | View active topics It is currently Thu Mar 28, 2024 9:24 am



Reply to topic  [ 1 post ] 
drawPoint 
Author Message
Regular pChart user
Regular pChart user

Joined: Wed Jun 01, 2011 11:42 am
Posts: 9
Post drawPoint
Another hack until the feature becomes available.. as usual no guarantee that it works for you ;-P

Add to pDraw.class.php
Code:
function drawPoint($SeriesName, $Index, $Value, $Format="") {
   $R         = isset($Format["R"]) ? $Format["R"] : 0;
   $G         = isset($Format["G"]) ? $Format["G"] : 0;
   $B         = isset($Format["B"]) ? $Format["B"] : 0;
   $Alpha      = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;

   $Data = $this->DataSet->getData();
   list($XMargin,$XDivs) = $this->scaleGetXSettings();
   if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
   $X = $this->GraphAreaX1 + $XMargin + $Index * $XStep;
   $Y =  floor($this->scaleComputeY($Value,array("AxisID"=>0)));

   $this->drawFilledCircle($X,$Y,3,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha));
}


Now go for it..
$this->pChart->drawPoint("Date", $index, $weekDay * 60, array("R"=>255));

=> Value must be appropriate for the AXIS format. In my case the Y-value must be given in seconds and weekDay is the day of the week. Doesn't make sense at all, but shows how it works. There's some space for improvement (like different objects or putting images directly), dunno know how I will use it in the end (I just know I need it ;-)), I may post some update to it..


Attachments:
pcharttest.png
pcharttest.png [ 60.3 KiB | Viewed 7164 times ]
Fri Jun 24, 2011 4:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron