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