Added --style.

Use Pod::Usage.
Improved doc.
This commit is contained in:
hjp 2006-09-30 10:28:19 +00:00
parent 99f7bdff4a
commit 464d8c4233
1 changed files with 35 additions and 4 deletions

39
tsplotv
View File

@ -4,24 +4,53 @@
tsplotv - plot time series given in vertical format tsplotv - plot time series given in vertical format
=head1 SYNOPSIS
tsplotv
[--legend-position pos]
[--output-format format ]
[--stacked]
[--style style]
[file ...]
=head1 DESCRIPTION =head1 DESCRIPTION
This program expects time series data in vertical format, I.e., This program expects time series data in vertical format, I.e.,
each line contains a tripel <time, series, value>. each line contains a tripel <time, series, value>.
The default legend position is "top right", same as with gnuplot.
Another frequently useful position (especially if you have lots of series)
is "below. Note that positions which consist of several world (such as
"top right" need to be passed to tsplotv as a single argument, so the
space needs to be hidden from the shell by use of quotes or a backslash.
The default output format is "png", the default style is "lines".
See L<TimeSeries> for a description of possible legend positions,
output formats, and styles.
The --stacked option causes the time series to be stacked on top of each
other.
=cut =cut
use strict; use strict;
use TimeSeries; use TimeSeries;
use Getopt::Long; use Getopt::Long;
use Pod::Usage;
my $help;
my $legend_position = 'top right';
my $output_format ='png'; my $output_format ='png';
my $stacked = 0; my $stacked = 0;
my $legend_position = 'top right'; my $style = "lines";
GetOptions('output_format|output-format=s' => \$output_format, GetOptions('help|?' => \$help,
'stacked' => \$stacked,
'legend_position|legend-position=s' => \$legend_position, 'legend_position|legend-position=s' => \$legend_position,
) or die "Usage: $0 [--output_format format] [files...]\n"; 'output_format|output-format=s' => \$output_format,
'stacked' => \$stacked,
'style:s' => \$style,
) or pod2usage(2);
pod2usage(1) if $help;
binmode STDOUT, ':raw'; binmode STDOUT, ':raw';
@ -41,6 +70,8 @@ my @series = sort { $series{$a} <=> $series{$b} } keys %series;
$ts->legend(@series); $ts->legend(@series);
$ts->legend_position($legend_position); $ts->legend_position($legend_position);
$ts->stacked($stacked); $ts->stacked($stacked);
$ts->style($style);
for my $timestamp (sort keys %data) { for my $timestamp (sort keys %data) {
my %d = %{$data{$timestamp}}; my %d = %{$data{$timestamp}};
my @values = @d{@series}; my @values = @d{@series};