View unanswered posts | View active topics It is currently Sat Feb 24, 2024 3:21 pm



Reply to topic  [ 2 posts ] 
HELP WANTED WITH SCATTERED CHART 
Author Message
Regular pChart user
Regular pChart user

Joined: Fri Apr 20, 2012 10:15 am
Posts: 9
Post HELP WANTED WITH SCATTERED CHART
Hi all,

finally i can work with scattered charts, but i have a problem.

I would like to realize something like this :

20
19
18
17
16
15
14
13
12
00:00 01:00 02:00 03:00 04:00 05:00 06:00 07:00 08:00 09:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00 19:00 20:00


Here is the code:


Code:
<?php require_once('../../../Connections/VirtualZeroConn.php'); ?>
<?php



mysql_select_db($database_VirtualZeroConn, $VirtualZeroConn);
      $query_Recordset1 = "SELECT archive.*
                       FROM archive
                      LIMIT 24";
      $Recordset1 = mysql_query($query_Recordset1, $VirtualZeroConn) or die(mysql_error());
      $row_Recordset1 = mysql_fetch_assoc($Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($Recordset1);

/* Include all the classes */
include("../../pChart/class/pDraw.class.php");
include("../../pChart/class/pImage.class.php");
include("../../pChart/class/pData.class.php");
include("../../pChart/class/pScatter.class.php");


$temperatura = array();

$data = array();

do{
   
    //Push temperatura
    array_push($temperatura,$row_Recordset1['inTemp']);
   
    //push DateTime
    array_push($data,date($row_Recordset1['dateTime']));
   
   
}while($row_Recordset1 = mysql_fetch_assoc($Recordset1));

  $myData = new pData();
$myData->addPoints($data,"X");
$myData->addPoints($temperatura,"Y");


/* Bind the X serie to the X axis */
$myData->setAxisName(0,"Tempo");
$myData->setAxisXY(0,AXIS_X);
$myData->setAxisDisplay(0,AXIS_FORMAT_TIME,"H:i:s");
$myData->setAxisPosition(0,AXIS_POSITION_BOTTOM);

/* Bind the Y serie to the Y axis */
$myData->setAxisName(1,"Temperature");
$myData->setAxisXY(1,AXIS_Y);
$myData->setSerieOnAxis("Y",1);
$myData->setAxisPosition(1,AXIS_POSITION_LEFT);

/* Create the scatter serie */
$myData->setScatterSerie("X","Y",0);
   

$myPicture = new pImage(700,300,$myData);


$myPicture->setFontProperties(array("FontName"=>"../../pChart/fonts/Forgotte.ttf","FontSize"=>10));

$myPicture->setGraphArea(60,40,670,190);


/* Create the Scatter chart object */
$myScatter = new pScatter($myPicture,$myData);
$ScaleSettings = array("GridR"=>50,"GridG"=>50,"GridB"=>50);
$myScatter->drawScatterScale($ScaleSettings);
   
$myScatter->drawScatterPlotChart();


$myScatter->drawScatterLineChart();


$myPicture->Stroke();



?>



With this code i can generate this image :

Image

I want, in the x axys to be displayed what i meant above, 24 hour format and the data of inTemp displayed exactly depending on dateTime.

Anyone can help me to solve this?

Thanks,

Cristian


Tue Apr 24, 2012 5:19 pm
Profile
pChart user
pChart user

Joined: Mon Jul 09, 2012 9:23 pm
Posts: 4
Post Re: HELP WANTED WITH SCATTERED CHART
HI, i have exactely the same question.

Can anyone help us please?


Thanx


Wed Jul 11, 2012 1:39 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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