PLOT SCATTERED AND NOT CONTINOUS X SCALE
Hi all,
i'm a newbie and i am having troubles.
My situation is the following:
I'm collecting data from a meteo station and storing it in a database.
I have to manage two different kind of datas, DateTime and Temperature.
Temperature and Datetime are 2 arrays of the same length, but with the problem that dateTime can be discountinuous and scattered in time.
Temperature[i] is the temperature measured at the instant of DateTime[i].
My goal is to plot temperature as function of dateTime. (linear fit) In Matlab Language it would be just plot(dateTime,temperature);
Is there the possibility to do something similar with this library ?
I'll post an example of my trouble:
Code:
<?php
include("../../pChart/class/pDraw.class.php");
include("../../pChart/class/pImage.class.php");
include("../../pChart/class/pData.class.php");
$myData = new pData();
$dateTime = array("08:00","09:00","12:00","13:00");
$myData->addPoints( $dateTime,"Labels");
$myData->setSerieDescription("Labels","Ore");
$myData->setAbscissa("Labels");
$temperature=array("12","13","14","30");
$myData->addPoints($temperature);
$myPicture = new pImage(1100,230,$myData);
$myPicture->setFontProperties(array("FontName"=>"../../pChart/fonts/Forgotte.ttf","FontSize"=>10));
$myPicture->drawText(10,20,"Temperatura 24h");
$myPicture->setGraphArea(60,40,1100,190);
$myPicture->drawScale();
$myPicture->drawLineChart();
$myPicture->Stroke();
?>
The graph generated is:
If you take a look at the X axys the distance between 09:00 and 12:00 is the same as the distance between 08:00 and 09:00.
I would like to avoid this and plot temperature[i] at the X value = datetime[i].
Regards,
Cristian