From: "Neal S. Pressman" <nsp83273@melsud.res.ray.com>
when i first installed ver 0.63 i had made some changes to grapher.cgi
to add in a description to the top of the image and to change the
background color:
'--color', "CANVAS\#c0c0c0",
'--title', "$targRef->{'long-desc'}",
i simply added them into @args
i also added in:
$xaxiscmd, $xaxis,
this was defined in the same code as the $vruleColor and $rangeType
here is my code from version 0.63:
#RANGE#
my($vruleColor) = graphParam('vrule-color', undef, undef);
my($xaxis) = "MINUTE:60:HOUR:2:HOUR:2:0:\%H";
my($xaxiscmd) = "--x-grid";
my(@vrules);
if (defined($vruleColor) and $vruleColor ne 'none') {
$vruleColor = colorToCode($vruleColor);
my($rangeType) = rangeType($range);
# first, find the time of the most recent zero mark
my($timeToZeroTime) = 0;
my($deltaZeroTime) = 0; # the number of seconds between zero times
my($now) = time();
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now);
# find out how many seconds we are past the last zero time
$timeToZeroTime += $sec;
$timeToZeroTime += $min * 60;
$timeToZeroTime += $hour * 60 * 60;
$deltaZeroTime = 60 * 60 * 24;
if ($rangeType == $main::kTypeWeekly) {
my($numDaysToMonday) = ($wday - 1);
$timeToZeroTime += $numDaysToMonday * 60 * 60 * 24;
$deltaZeroTime *= 7;
$xaxis = "HOUR:6:HOUR:24:DAY:1:86400:\%a";
}
if ($rangeType == $main::kTypeMonthly) {
$timeToZeroTime += ($mday - 1) * 60 * 60 * 24;
$deltaZeroTime *= 30;
$xaxis = "DAY:1:DAY:7:DAY:7:0:\%b_%d";
}
if ($rangeType == $main::kTypeYearly) {
$timeToZeroTime += $yday * 60 * 60 * 24;
# yikes... what about leap year? Ick.
$deltaZeroTime *= 365;
$xaxis = "WEEK:1:MONTH:1:MONTH:1:18144000:\%b";
}
the purpose of this change was to change how the information was outputed
on the image the syntax is taken straight from the RRDTOOL docs.
i have tried both 0.68 and 0.69 and neither will accept my $xaxis code
i takes the initial value and applys it to all rangetypes its almost as if
the if ($rangeType == code is never being executed
this is my current code from grapher.cgi in ver 0.69:
#RANGE#
my($vruleColor) = graphParam($gRefDef, 'vrule-color', undef);
my($xaxis) = "MINUTE:60:HOUR:2:HOUR:2:0:\%H";
my($xaxiscmd) = "--x-grid";
my(@vrules);
if (defined($vruleColor) and $vruleColor ne 'none') {
$vruleColor = colorToCode($colorRef, $vruleColor);
my($rangeType) = rangeType($range);
# first, find the time of the most recent zero mark
my($timeToZeroTime) = 0;
my($deltaZeroTime) = 0; # the number of seconds between zero times
my($now) = time();
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now);
# find out how many seconds we are past the last zero time
$timeToZeroTime += $sec;
$timeToZeroTime += $min * 60;
$timeToZeroTime += $hour * 60 * 60;
$deltaZeroTime = 60 * 60 * 24;
if ($rangeType == $kTypeWeekly) {
my($numDaysToMonday) = ($wday - 1);
$timeToZeroTime += $numDaysToMonday * 60 * 60 * 24;
$deltaZeroTime *= 7;
$xaxis = "HOUR:6:HOUR:24:DAY:1:86400:\%a";
}
if ($rangeType == $kTypeMonthly) {
$timeToZeroTime += ($mday - 1) * 60 * 60 * 24;
$deltaZeroTime *= 30;
$xaxis = "DAY:1:DAY:7:DAY:7:0:\%b_%d";
}
if ($rangeType == $kTypeYearly) {
$timeToZeroTime += $yday * 60 * 60 * 24;
# yikes... what about leap year? Ick.
$deltaZeroTime *= 365;
$xaxis = "WEEK:1:MONTH:1:MONTH:1:18144000:\%b";
}
my($zeroTime) = $now - $timeToZeroTime;
--------------------------- ONElist Sponsor ----------------------------
Enter ONElist’s WEEKLY DRAWING for $100!
http://www.onelist.com
By joining the FRIENDS & FAMILY PROGRAM. See homepage for details.
------------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Mon Mar 06 2000 - 19:00:58 PST