PDA

View Full Version : Change time range on graphs


n8wood
10-11-2004, 17:05
Hi, is there any way to change the range of time from 1 hour to something larger on the custom graphs?

Thanks!

joe
01-12-2004, 20:36
I am wondering about this same thing. The graphs all default to 1hr, and can be changed manually when you are viewing the graph.

I want to default the graphs to something else (say 24 hours). This setting also impacts the screens. IMO, 1 hour graphs don't mean too much to me (network admin), and currently there doesn't seem to be a way to change what the screens show.

Anyone know how to change this behavior?

Thanks!

joe

mucknet
01-12-2004, 21:29
I agree that the screens page is almost useless without the ability to do a mass change to all the graphs on the screen at once.

Is this planned for 1.1?

joe
01-12-2004, 22:41
The bigger issue is that this information isn't stored in the database, so it's the PHP frontends job to determine the range.

However, maybe it would make sense to create another field in the graphs table to store the default time range? This field could default to 1hr, and it wouldn't be any different than it is now. The PHP frontend would then pull that value from the database, and it could be overwritten by the frontend if another range is chosen?

In the meantime, I think I will just hardcode the time range to 8 hours (86400 seconds). This is from charts.php in 1.1alpha2.

if(!isset($_GET["period"]))
{
$_GET["period"]=86400;
}


And to change the range in the screens... screens.php:

if(DBnum_rows($iresult)>0)
{
if($resource == 0)
{
echo "<a href=charts.php?graphid=$resourceid><img src='chart2.php?graphid=$resourceid&width=$width&height=$height&period=86400&border=0' border=0></a>";
}
else if($resource == 1)
{
echo "<a href=history.php?action=showhistory&itemid=$resourceid><img src='chart.php?itemid=$resourceid&width=$width&height=$height&period=86400&border=0' border=0></a>";
}


Basically just change the 2 &period=3600 to whatever range you want, in seconds.

NOTE: I haven't tested this to see if it breaks anything else, but it works for me. :)

joe