timeseries/tsplot

27 lines
561 B
Perl
Executable File

#!/usr/bin/perl -w
use strict;
use TimeSeries;
use Getopt::Long;
my $output_format ='png';
GetOptions('output_format|output-format=s' => \$output_format)
or die "Usage: $0 [--output_format format] [files...]\n";
binmode STDOUT, ':raw';
my $ts = TimeSeries->new(output_format => $output_format);
while (<>) {
my @legend = split;
shift @legend; # first must be for timestamp
$ts->legend(@legend);
last;
}
while (<>) {
my ($timestamp, @values) = split();
$ts->add_timestring($timestamp, @values);
}
my $g = $ts->plot();
print $g