Align documentation and implementation

This commit is contained in:
Peter J. Holzer 2022-03-19 19:09:19 +01:00 committed by Peter J. Holzer
parent 730393cb18
commit 4139bb644a
1 changed files with 12 additions and 11 deletions

View File

@ -10,7 +10,7 @@ use TimeSeries;
=head1 NAME
tsplot - plot time series in column format
tsplotsql - plot time series from sql query
=head1 SYNOPSIS
@ -23,15 +23,14 @@ tsplot
[--style style]
[--time_t]
[--yrange min max]
[query ...]
[--log_y]
query
=head1 DESCRIPTION
This program expects time series data in column format, I.e.,
each line contains a timestamp and the values for each series, except
the first one which contains the column headers, which are used for the
legend. Columns are separated by any amount of whitespace unless the
--tsv option is given which enables tab-separated columns.
This program expects time series data from an SQL query in column
format, I.e., each row contains a timestamp and the values for each
series. The column names are used for the legend.
The default legend position is "top right", same as with gnuplot.
Another frequently useful position (especially if you have lots of series)
@ -56,32 +55,34 @@ my $output_format ='png';
my $log_y =0;
my $time_t =0;
my $style = "lines";
my $tsv = 0;
my $stacked = 0;
my @yrange;
my $keeptempfiles;
my $finalresolution;
my $legend_position = 'top right';
my $dbname;
GetOptions('output_format|output-format=s' => \$output_format,
'log_y|log-y' => \$log_y,
'time_t' => \$time_t,
'style=s' => \$style,
'tsv' => \$tsv,
'stacked' => \$stacked,
'yrange=s{2}' => \@yrange,
'keeptempfiles' => \$keeptempfiles,
'finalresolution=i' => \$finalresolution,
'legend-position=s' => \$legend_position,
'dbname=s' => \$dbname,
)
or pod2usage(verbose => 0);
my $sep = $tsv ? qr/\t/ : ' ';
unless ($ARGV[0]) {
pod2usage(verbose => 0);
}
binmode STDOUT, ':raw';
my $ts = TimeSeries->new(output_format => $output_format);
$ts->{keeptempfiles} = 1 if $keeptempfiles;
$ts->legend_position($legend_position);
my $dbh = DBIx::SimpleConnect->connect($dbname);
my $sth = $dbh->prepare($ARGV[0]);