chiark / gitweb /
optional title arg to graph_of_group
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Sep 2013 13:20:26 +0000 (14:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Sep 2013 13:20:26 +0000 (14:20 +0100)
cgi

diff --git a/cgi b/cgi
index 968745e218940818a98a7b86657802efc62a2d0c..489037409d73010192f5ae2d803988084aef01af 100755 (executable)
--- a/cgi
+++ b/cgi
@@ -45,11 +45,16 @@ our $SELF= '/home/ijackson/things/rrd-graphs';
 
 our @timeranges= (3600, map { $_*86400 } qw(1 7 28), 13*7+1, 366);
 
-sub graph_of_group ($$$$$) {
-    my ($section, $group, $elem, $basis, $args) = @_;
+sub graph_of_group ($$$$$;$) {
+    my ($section, $group, $elem, $basis, $args, $title) = @_;
     $basis->{Args}= $args;
     $basis->{Slower}= 0 unless exists $basis->{Slower};
     $basis->{TimeRanges} ||= \@timeranges;
+    if (!defined $title) {
+       $title = $group;
+       if (length $elem) { $title.= " $elem"; }
+    }
+    $basis->{Title} = $title;
     $graphs{$section,$group,$elem}= $basis;
     if (!exists $group_elems{$section,$group}) {
        # new group then
@@ -458,9 +463,7 @@ if (defined $elem) {
     s,\<interval/(\d+)\>, $end/$1 ,ge foreach @args;
     unshift @args, qw(--end now --start), "end-${end}s";
     
-    my $title= $group;
-    if (length $elem) { $title.= " $elem"; }
-
+    my $title = $g->{Title};
     $title .= " $g->{Units}" if $g->{Units};
     unshift @args, '-t', $title, '-w',$width, '-h',$height;
     unshift @args, qw(-a PNG --full-size-mode);