Option --colors.
This commit is contained in:
parent
06b3d02fd9
commit
8f8955978d
|
@ -33,7 +33,7 @@ use HTTP::Date qw(parse_date);
|
|||
use Time::Local qw(timegm_nocheck);
|
||||
use POSIX qw(strftime);
|
||||
|
||||
our $VERSION = do { my @r=(q$Revision: 1.23 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
||||
our $VERSION = do { my @r=(q$Revision: 1.24 $=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};
|
||||
|
||||
our $debug;
|
||||
|
||||
|
@ -292,6 +292,21 @@ sub yrange {
|
|||
}
|
||||
|
||||
|
||||
=head2 colors(@colors)
|
||||
|
||||
Get or set the color palette.
|
||||
|
||||
=cut
|
||||
|
||||
sub colors {
|
||||
my ($self, @colors) = @_;
|
||||
|
||||
if (@colors) {
|
||||
$self->{colors} = [@colors];
|
||||
}
|
||||
return @colors;
|
||||
}
|
||||
|
||||
|
||||
=head2 dstcorr $time [, $period]
|
||||
|
||||
|
@ -399,16 +414,20 @@ sub plot {
|
|||
my $comma = 0;
|
||||
my $col = 2;
|
||||
|
||||
for my $i (@{$self->{legend}}) {
|
||||
for my $i (0 .. $#{$self->{legend}}) {
|
||||
if ($comma) {
|
||||
print $ctlfh ", ";
|
||||
} else {
|
||||
$comma = 1;
|
||||
}
|
||||
my $legend = $self->{legend}[$i];
|
||||
if ($self->{style} eq 'filledcurves') {
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, "):(0) title '$i'";
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, "):(0) title '$legend'";
|
||||
} else {
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, ") title '$i'";
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, ") title '$legend'";
|
||||
}
|
||||
if (my $color = $self->{colors}[$i]) {
|
||||
print $ctlfh " linecolor rgbcolor '$color'";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
5
tsplotv
5
tsplotv
|
@ -49,6 +49,7 @@ my $style = "lines";
|
|||
my $log_y = 0;
|
||||
my $finalresolution;
|
||||
my $time_t = 0;
|
||||
my $colors;
|
||||
|
||||
GetOptions('help|?' => \$help,
|
||||
'legend_position|legend-position=s' => \$legend_position,
|
||||
|
@ -58,6 +59,7 @@ GetOptions('help|?' => \$help,
|
|||
'log_y|log-y' => \$log_y,
|
||||
'finalresolution' => \$finalresolution,
|
||||
'time_t' => \$time_t,
|
||||
'colors=s' => \$colors,
|
||||
) or pod2usage(2);
|
||||
pod2usage(1) if $help;
|
||||
|
||||
|
@ -82,6 +84,9 @@ $ts->stacked($stacked);
|
|||
$ts->style($style);
|
||||
$ts->log_y($log_y);
|
||||
$ts->finalresolution($finalresolution) if $finalresolution;
|
||||
if ($colors) {
|
||||
$ts->colors(split(/,/, $colors));
|
||||
}
|
||||
|
||||
for my $timestamp (sort keys %data) {
|
||||
my %d = %{$data{$timestamp}};
|
||||
|
|
Loading…
Reference in New Issue