header option to prepend value scale
[barcat.git] / barcat
diff --git a/barcat b/barcat
index db0aefa23fb370051399b502954972f388f39281..268c993db3a76b223e04114c6506489b727e5c25 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -42,6 +42,7 @@ GetOptions(\%opt,
                        " (range expected)\n"
                );
        },
+       'header!',
        'markers|m=s',
        'graph-format=s' => sub {
                $opt{'graph-format'} = substr $_[1], 0, 1;
@@ -192,6 +193,8 @@ sub sival {
        );
 }
 
+say sprintf '%*s-+%*s-+', $lenval, $minval, $size * ($maxval - $minval) - 3, $maxval if $opt{header};
+
 while ($nr <= $#lines) {
        $nr >= $opt{hidemax} and last if defined $opt{hidemax};
        my $val = $values[$nr];
@@ -294,6 +297,10 @@ A string can indicate the starting position of a value
 or capture the numbers itself,
 for example I<-f'(\d+)'> for the first digits anywhere.
 
+=item --header
+
+Prepend a chart axis with minimum and maximum values labeled.
+
 =item -H, --human-readable
 
 Format values using SI unit prefixes,