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 :
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