Re: Obtain the position of the added points
if you don't want to use
writeLabel but instead
drawText you will have to calculate the positions upon your data and settings for the image and graph area
your image is 900px wide and 530px high: $myPicture = new pImage(900, 530, $MyData);
within the graph area starting at 80px (X) and 40px (Y) from top left : $myPicture->setGraphArea(80, 40, 750, 200);
the area is 750px wide and 200px high and you're using margin 10px (X) and 10px (Y) in $scaleSettings
so the resulting area which displays your data is 740px wide and 190px high starting at 90,50 from top left within the image
it would be easier to get these things done, if you define your series in separate arrays instead of using the rand() function within $MyData->addPoints();
so let's guess you have extra arrays, let' call them $seriesTG, $seriesTR, $seriesTL, $seriesTY, $seriesTJ,
which will be used like $MyData->addPoints($seriesTG, "Tech Gérald"); and which you have filled with the random values before
you have 5 values per series which equals count($seriesTG), so there are 4 distances inbetween on the abscissa and the ordinate has its maximum at 25 heures
the abscissa starts at 90,240 within the image and which is the origin of this coordinate system
740px width / 4 distances = 185px between the added points
X-values for $seriesTG[i] (and for the other too) are:
[0] at 90px
[1] at 90px + 185px (= 275)
[2] at 275px + 185px (= 460)
[3] at 460px + 185px (= 645)
[4] at 645px + 185px (= 90 + 740) (= 830)
now you have to get the Y-values, which is quite simple too
190px height / 25 heures = 7.6 which gives us about 8px per hour
Y-values for $seriesTG[i] (and for the other too) are:
floor($seriesTG[0] * 190/25) = e.g. 15px (2 hours)
floor($seriesTG[1] * 190/25) = e.g. 38px (5 hours)
floor($seriesTG[2] * 190/25) = e.g. 91px (12 hours)
floor($seriesTG[3] * 190/25) = e.g. 60px (8 hours)
floor($seriesTG[4] * 190/25) = e.g. 76px (10 hours)
these Y-values must be subtracted from 240px abscissa y-position within the image (from top)
combined with the X-values from above
you get something like this for the $seriesTG
$seriesTG[0] at 90, 15
$seriesTG[1] at 275, 38
$seriesTG[2] at 460, 91
$seriesTG[3] at 645, 60
$seriesTG[4] at 830, 76
these are the coordinates for your drawText, if you calculate it with variables only, it should adapt to different series
perhaps you want a little space next to the points, so just add e.g. 8px to these X-values (and look at the Align option of drawText)
but i think the easier way is to use the built in writeLabel function and turn off all styling and only use plain text insteadthereto look at $LabelSettings options