[freeside-commits] freeside/FS/FS svc_port.pm,1.9,1.10

Erik Levinson levinse at wavetail.420.am
Wed Feb 2 22:18:43 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv8243/FS/FS

Modified Files:
	svc_port.pm 
Log Message:
torrus misc fixes, RT10574

Index: svc_port.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_port.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -d -r1.9 -r1.10
--- svc_port.pm	31 Jan 2011 06:53:06 -0000	1.9
+++ svc_port.pm	3 Feb 2011 06:18:41 -0000	1.10
@@ -254,6 +254,8 @@
         $start = $opt{start} if $opt{start};
         $end = $opt{end} if $opt{end};
 
+	$end = $now if $end > $now;
+
         return 'Invalid date range' if ($start < 0 || $start >= $end 
             || $end <= $start || $end < 0 || $end > $now || $start > $now
             || $end-$start > 86400*366 );
@@ -292,8 +294,8 @@
         foreach my $rec ( @records ) {
             push @times, $rec->_date 
                 unless grep { $_ eq $rec->_date } @times;
-            push @in, $rec->value if $rec->serviceid =~ /_IN$/;
-            push @out, $rec->value if $rec->serviceid =~ /_OUT$/;
+            push @in, $rec->value*8 if $rec->serviceid =~ /_IN$/;
+            push @out, $rec->value*8 if $rec->serviceid =~ /_OUT$/;
         }
 
         my $timediff = $times[-1] - $times[0]; # they're sorted ascending
@@ -340,8 +342,14 @@
 
       my @data = ( \@times, \@in, \@out );
 
+      
       # hardcoded size, colour, etc.
-      my $graph = new GD::Graph::mixed(600,360);  #600,400
+
+      # don't change width/height other than through here; breaks legend otherwise
+      my $width = 600;
+      my $height = 360;
+
+      my $graph = new GD::Graph::mixed($width,$height);  
       $graph->set(
         types => ['area','lines'],
         dclrs => ['green','blue'],
@@ -364,6 +372,7 @@
             my $value = shift;
             $self->_format_bandwidth($value,1);
         },
+	y_tick_number => 'auto',
         y_label => 'bps',
         legend_placement => 'BR',
 	lg_cols => 1,
@@ -389,9 +398,9 @@
       return "graph error: ".$graph->error unless($gd);
 
       my $black = $gd->colorAllocate(0,0,0);       
-      $gd->string(gdMediumBoldFont,50,285,
+      $gd->string(gdMediumBoldFont,50,$height-35,
 	    "Current: $in_curr   Average: $in_avg   Maximum: $in_max   Minimum: $in_min",$black);
-      $gd->string(gdMediumBoldFont,50,305,
+      $gd->string(gdMediumBoldFont,50,$height-15,
 	    "Current: $out_curr   Average: $out_avg   Maximum: $out_max   Minimum: $out_min",$black);
 
       return $gd->png;



More information about the freeside-commits mailing list