View unanswered posts | View active topics It is currently Mon Apr 29, 2024 7:18 am



Reply to topic  [ 2 posts ] 
Please help.. 
Author Message
New pChart user
New pChart user

Joined: Wed Jun 13, 2012 4:33 pm
Posts: 1
 Please help..
So I am new here, hopping the community can help me... I've spend last two days struggling to get this working.. Would love to incorporate these in my project... and if I can prove that it can work, my employer will purchase a server lic...
Thank you in advance for any hlp you may be able to provide. ...


my first problem is even though i see gd enabled in phpinfo, I when I do
if (!extension_loaded(‘gd‘) && !extension_loaded(‘gd2‘))
{
echo 'Extension not loaded';
}
the page shows Extension not loaded, can some one help me with this... I am using MMAP with php 5.3.6 on Macbook Air.

Here is the project .....

So here is what i am trying to do.. [ this is a basic example, I am sure if i can get this working, I can figure out the rest]
have a mySQL db..
table name - requests
column 1 - timestamp
column 2 - Value

table contains temp values for various parts of a machine and each part's name is stored in the name column. The timestamp is just when it was stored.
I would like to be able to pull data for each unique point, and show it in a line graph.
Here is what I have so far
Code:
$db = 'dbname';

$query = "SELECT * FROM Request";
$Result  = mysql_query($query,$db);
while($row = mysql_fetch_array($Result)){
  /* Get the data from the query result */
   $timestamp   = $row["Timestamp"];
   $Value = $row["Value"];
}
     /* Save the data in the pData array */
   $myData->addPoints($timestamp,"Time");
   $myData->addPoints($Value,"Value");

   
   /* Put the timestamp column on the abscissa axis */
   $myData->setAbscissa("Time");
   
   /* Name this axis "Time" */
   $myData->setXAxisName("Time");
   
   /* Specify that this axis will display time values */
   $myData->setXAxisDisplay(AXIS_FORMAT_TIME,"H:i");
   
   /* First Y axis will be dedicated to the Value */
   $myData->setAxisName(0,"Value");
   $myData->setAxisUnit(-90,"");
   
   $myPicture->autoOutput("pictures/example.drawLineChart.plots.png");



Wed Jun 13, 2012 4:49 pm
Profile
Experienced pChart user
Experienced pChart user

Joined: Tue Aug 02, 2011 11:49 pm
Posts: 34
Post Re: Please help..
first of all what is "MMAP with php 5.3.6 on Macbook Air"
something like XAMPP?

try
Code:
echo "<pre>";
var_dump(gd_info());
echo "</pre>";

// or

echo "<pre>";
print_r(gd_info());
echo "</pre>";
instead of your gd extension loaded testing
this will show you an array with gd version and settings

for charting keep things separated
catch your sql data first and process the data to your desired structure

define your chart in a separate file using only variables and arrays for the series data to be displayed, even for the title and so on

test your chart first with manually edited data to make sure all works fine

after that you just include the pChart classes an your chart producing file into the main file which receives the sql data


Wed Jun 13, 2012 11:28 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 23 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: