View unanswered posts | View active topics It is currently Mon Apr 29, 2024 1:24 pm



Reply to topic  [ 2 posts ] 
PLOT SCATTERED AND NOT CONTINOUS X SCALE 
Author Message
Regular pChart user
Regular pChart user

Joined: Fri Apr 20, 2012 10:15 am
Posts: 9
Post 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:
Image

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


Fri Apr 20, 2012 11:13 am
Profile
New pChart user
New pChart user

Joined: Wed May 16, 2012 12:11 pm
Posts: 1
Post Re: PLOT SCATTERED AND NOT CONTINOUS X SCALE
Hi cbaldinu!

I'm struggling with the same problem here. I have also timestamp data on x-axle and it is not continous, might have burst of data every now and then.

I stumbled to this post: http://wiki.pchart.net/forum/viewtopic.php?f=1&t=173 in this forum and I though to try it. Now it supports only step charts, but I think the code could be applied to scatter and normal charts too.

I'll post updates if I get it working. But anyway, this chart library is superb!

Cheers,
Jukka


Wed May 16, 2012 12:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 28 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