Add parameter --yrange

This commit is contained in:
Peter J. Holzer 2019-02-10 15:03:31 +01:00
parent 55a1151be7
commit 70388313a2
1 changed files with 10 additions and 0 deletions

10
tsplotv
View File

@ -16,6 +16,7 @@ tsplotv
[--time_t]
[--colors rgb-list]
[--configfile yaml]
[--yrange min:max]
[file ...]
=head1 DESCRIPTION
@ -55,6 +56,7 @@ my $finalresolution;
my $time_t = 0;
my $colors;
my $configfile;
my $yrange;
GetOptions('help|?' => \$help,
'legend_position|legend-position=s' => \$legend_position,
@ -66,6 +68,7 @@ GetOptions('help|?' => \$help,
'time_t' => \$time_t,
'colors=s' => \$colors,
'configfile=s' => \$configfile,
'yrange=s' => \$yrange,
) or pod2usage(2);
pod2usage(1) if $help;
@ -106,6 +109,13 @@ $ts->log_y($log_y);
$ts->finalresolution($finalresolution) if $finalresolution;
$ts->colors(map $config->{timeseries}{$_}{color}, @series);
if ($yrange) {
$yrange =~s /^\[(.*)\]$/$1/; # remove optional brackets
my ($min, $max) = $yrange =~ /^(\*|[-+0-9E.]+):(\*|[-+0-9E.]+)$/;
$ts->yrange($min, $max);
}
for my $timestamp (sort keys %data) {
my %d = %{$data{$timestamp}};
my @values = @d{@series};