From 70388313a23df100ecb7f0abde301933745cfdc9 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 10 Feb 2019 15:03:31 +0100 Subject: [PATCH] Add parameter --yrange --- tsplotv | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tsplotv b/tsplotv index 23fd9a8..445e59a 100755 --- a/tsplotv +++ b/tsplotv @@ -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};