mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-06 06:21:16 +08:00
--curvestyle no longer adds on top of --curvestyleall
This commit is contained in:
parent
ba4cc66fe8
commit
6397548515
@ -95,8 +95,9 @@ sub interpretCommandline
|
|||||||
|
|
||||||
# Previously I was using 'legend=s%' and 'curvestyle=s%' for curve addressing. This had cleaner
|
# Previously I was using 'legend=s%' and 'curvestyle=s%' for curve addressing. This had cleaner
|
||||||
# syntax, but disregarded the order of the given options. This resulted in arbitrarily ordered
|
# syntax, but disregarded the order of the given options. This resulted in arbitrarily ordered
|
||||||
# curves.
|
# curves. I thus make parse these into lists, and then also make hashes, for later use
|
||||||
# needed for these to be parsed into a ref to a list
|
|
||||||
|
# needed for these to be parsed into an array-ref
|
||||||
$options{legend} = [];
|
$options{legend} = [];
|
||||||
$options{curvestyle} = [];
|
$options{curvestyle} = [];
|
||||||
$options{histogram} = [];
|
$options{histogram} = [];
|
||||||
@ -124,6 +125,21 @@ sub interpretCommandline
|
|||||||
if defined $options{$listkey};
|
if defined $options{$listkey};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --legend and --curvestyle options are conceptually hashes, but are parsed as
|
||||||
|
# arrays in order to preserve the ordering. I parse both of these into hashes
|
||||||
|
# because those are useful to have later. After this I can access individual
|
||||||
|
# legends with $options{legend_hash}{curveid}
|
||||||
|
for my $listkey (qw(legend curvestyle))
|
||||||
|
{
|
||||||
|
$options{"${listkey}_hash"} = {};
|
||||||
|
|
||||||
|
my $n = scalar @{$options{$listkey}}/2;
|
||||||
|
foreach my $idx (0..$n-1)
|
||||||
|
{
|
||||||
|
$options{"${listkey}_hash"}{$options{$listkey}[$idx*2]} = $options{$listkey}[$idx*2 + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# parse stream option. Allowed only numbers >= 0 or 'trigger'
|
# parse stream option. Allowed only numbers >= 0 or 'trigger'
|
||||||
if(defined $options->{stream})
|
if(defined $options->{stream})
|
||||||
{
|
{
|
||||||
@ -376,7 +392,10 @@ sub mainThread
|
|||||||
# For the specified values, set the legend entries to 'title "blah blah"'
|
# For the specified values, set the legend entries to 'title "blah blah"'
|
||||||
if(@{$options{legend}})
|
if(@{$options{legend}})
|
||||||
{
|
{
|
||||||
# @{$options{legend}} is a list where consecutive pairs are (curveID, legend)
|
# @{$options{legend}} is a list where consecutive pairs are (curveID,
|
||||||
|
# legend). I use $options{legend} here instead of $options{legend_hash}
|
||||||
|
# because I create a new curve when I see a new one, and the hash is
|
||||||
|
# unordered, thus messing up the ordering
|
||||||
my $n = scalar @{$options{legend}}/2;
|
my $n = scalar @{$options{legend}}/2;
|
||||||
foreach my $idx (0..$n-1)
|
foreach my $idx (0..$n-1)
|
||||||
{
|
{
|
||||||
@ -388,7 +407,10 @@ sub mainThread
|
|||||||
# add the extra curve options
|
# add the extra curve options
|
||||||
if(@{$options{curvestyle}})
|
if(@{$options{curvestyle}})
|
||||||
{
|
{
|
||||||
# @{$options{curvestyle}} is a list where consecutive pairs are (curveID, style)
|
# @{$options{curvestyle}} is a list where consecutive pairs are (curveID,
|
||||||
|
# style). I use $options{curvestyle} here instead of
|
||||||
|
# $options{curvestyle_hash} because I create a new curve when I see a new
|
||||||
|
# one, and the hash is unordered, thus messing up the ordering
|
||||||
my $n = scalar @{$options{curvestyle}}/2;
|
my $n = scalar @{$options{curvestyle}}/2;
|
||||||
foreach my $idx (0..$n-1)
|
foreach my $idx (0..$n-1)
|
||||||
{
|
{
|
||||||
@ -598,10 +620,14 @@ sub updateCurveOptions
|
|||||||
{ $title = $id; }
|
{ $title = $id; }
|
||||||
|
|
||||||
my $titleoption = defined $title ? "title \"$title\"" : "notitle";
|
my $titleoption = defined $title ? "title \"$title\"" : "notitle";
|
||||||
my $extraoption = defined $options{curvestyleall} ? $options{curvestyleall} : '';
|
|
||||||
|
my $curvestyleall = '';
|
||||||
|
$curvestyleall = $options{curvestyleall}
|
||||||
|
if defined $options{curvestyleall} && !defined $options{curvestyle_hash}{$id};
|
||||||
|
|
||||||
my $histoptions = $curveoptions->{histoptions} || '';
|
my $histoptions = $curveoptions->{histoptions} || '';
|
||||||
|
|
||||||
$curveoptions->{options} = "$histoptions $titleoption $curveoptions->{extraoptions} $extraoption";
|
$curveoptions->{options} = "$histoptions $titleoption $curveoptions->{extraoptions} $curvestyleall";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getCurve
|
sub getCurve
|
||||||
|
@ -46,7 +46,8 @@ passed in with C<--extracmds>. For example, to turn off the grid, pass in
|
|||||||
C<--extracmds 'unset grid'>. As many of these options as needed can be passed
|
C<--extracmds 'unset grid'>. As many of these options as needed can be passed
|
||||||
in. To add arbitrary curve styles, use C<--curvestyle curveID extrastyle>. Pass
|
in. To add arbitrary curve styles, use C<--curvestyle curveID extrastyle>. Pass
|
||||||
these more than once to affect more than one curve. To apply an extra style to
|
these more than once to affect more than one curve. To apply an extra style to
|
||||||
I<all> the curves, pass in C<--curvestyleall extrastyle>.
|
I<all> the curves that lack an explicit C<--curvestyle>, pass in
|
||||||
|
C<--curvestyleall extrastyle>.
|
||||||
|
|
||||||
=head2 Data formats
|
=head2 Data formats
|
||||||
|
|
||||||
@ -319,11 +320,13 @@ As an example, if line 3 of the input is "0 9 1 20"
|
|||||||
'cumulative', but rescaled to end up at 1.0.
|
'cumulative', but rescaled to end up at 1.0.
|
||||||
|
|
||||||
--curvestyle curveID style
|
--curvestyle curveID style
|
||||||
Additional styles per curve. With --dataid, curveID is the
|
Additional styles per curve. With --dataid, curveID is
|
||||||
ID. Otherwise, it's the index of the curve, starting at 0. Use
|
the ID. Otherwise, it's the index of the curve, starting
|
||||||
this option multiple times for multiple curves
|
at 0. Use this option multiple times for multiple curves.
|
||||||
|
--curvestylall does NOT apply to curves that have a
|
||||||
|
--curvestyle
|
||||||
|
|
||||||
--curvestyleall xxx Additional styles for ALL curves.
|
--curvestyleall xxx Additional styles for all curves that have no --curvestyle
|
||||||
|
|
||||||
--extracmds xxx Additional commands. These could contain extra global styles
|
--extracmds xxx Additional commands. These could contain extra global styles
|
||||||
for instance. Can be passed multiple times.
|
for instance. Can be passed multiple times.
|
||||||
|
Loading…
Reference in New Issue
Block a user