View unanswered posts | View active topics It is currently Sun Apr 28, 2024 7:44 pm



Reply to topic  [ 2 posts ] 
not sure how....hundreds of time values 
Author Message
New pChart user
New pChart user

Joined: Sun Feb 12, 2012 9:34 am
Posts: 1
Post not sure how....hundreds of time values
Hi All,

I'm not quite sure how to do this.

Lets say i'm logging my CPU util every 1-3 seconds to a table

Y axis would be the util value and the y would be the time value.

Instead of showing the time every 1-3 seconds in the X axis can i make it hourly for a 12-24 hour period? e.g. 11:00-12:00-13:00

I don't want to change the query to pull back an hourly value i want all the values

Also because the table is constantly updating can i make the graph update with it e.g. if you on the page with the graph it will update with new values without having to click.

I'm not sure if this makes sense, any help would be great.


Sun Feb 12, 2012 10:04 am
Profile
New pChart user
New pChart user

Joined: Thu Mar 29, 2012 6:57 pm
Posts: 1
Post Re: not sure how....hundreds of time values
This is my first day with pChart.

I'm just starting to do this and have a basic chart working. I collect some performance information every 10 mins. So you will have a lot more data if you collect every 1 to 3 seconds. If you collect data every second you will have 86,400 points every day. I would image if you try to chart that you will wait a long time for the chart to draw and you will not see all of the points. If your chart is 1000 pixels wide then 86,400 points has to fit into that space. That's not going to happen in a way that you will see what you intend to see.

You may want to consider either keeping a running average that averages all the points in a 1 min time period or even do a stock chart and display high, low, mean, 25 and 75 percentile for every hour. then you can drill in to any hour you want and display all of the points in that hour. But remember even in an hour there are 3600 seconds so you would have to have a very big monitor.

In terms of the x axis display

You can set pChart to display x axis labels only when they change. So I'm displaying the last 24 hours of day and only want to see hour markers.

This is the relevant code
Code:
$MyData->addPoints($xValueArray,"Labels");
$MyData->setAbscissa("Labels");
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME,"m/d\n  H");  // this is the key when the value that is output by this format changes then it will be displayed as the next xaxis tick mark.
...
// don't quote LABELING_DIFFERENT because it is a constant and not a string
$scaleSettings = array(
      "LabelingMethod"=> LABELING_DIFFERENT, "XMargin"=>10,"YMargin"=>10,
      "Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,
      "DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
$myPicture->drawScale($scaleSettings);


For auto refresh you can write some header information that sets the meta refresh tag http://en.wikipedia.org/wiki/Meta_refresh to do this in php http://us.php.net/manual/en/function.header.php There is an example in that pages that shows how. But this means you will have to query your database each time you do this.

I hope this helps.

Eric
:D


Thu Mar 29, 2012 9:15 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

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