mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
Added support for --every and --everyall
Needs documentation, tab completion
This commit is contained in:
parent
592ce20d1f
commit
5e0869dc25
@ -90,6 +90,7 @@ sub interpretCommandline
|
|||||||
$options{legend} = [];
|
$options{legend} = [];
|
||||||
$options{curvestyle} = [];
|
$options{curvestyle} = [];
|
||||||
$options{style} = [];
|
$options{style} = [];
|
||||||
|
$options{every} = [];
|
||||||
$options{histogram} = [];
|
$options{histogram} = [];
|
||||||
$options{x1y2} = [];
|
$options{x1y2} = [];
|
||||||
$options{x2y1} = [];
|
$options{x2y1} = [];
|
||||||
@ -114,6 +115,7 @@ sub interpretCommandline
|
|||||||
'zmin=f', 'zmax=f',
|
'zmin=f', 'zmax=f',
|
||||||
'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@',
|
'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@',
|
||||||
'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@',
|
'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@',
|
||||||
|
'every=s{2}', 'everyall=s',
|
||||||
'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
||||||
'equation=s@',
|
'equation=s@',
|
||||||
'image=s',
|
'image=s',
|
||||||
@ -178,7 +180,7 @@ sub interpretCommandline
|
|||||||
@{$options{$listkey}} = map split('\s*,\s*', $_), @{$options{$listkey}}
|
@{$options{$listkey}} = map split('\s*,\s*', $_), @{$options{$listkey}}
|
||||||
if defined $options{$listkey};
|
if defined $options{$listkey};
|
||||||
}
|
}
|
||||||
for my $listkey (qw(curvestyle rangesize tuplesize))
|
for my $listkey (qw(curvestyle rangesize tuplesize every))
|
||||||
{
|
{
|
||||||
next unless defined $options{$listkey};
|
next unless defined $options{$listkey};
|
||||||
my @in = @{$options{$listkey}};
|
my @in = @{$options{$listkey}};
|
||||||
@ -253,7 +255,7 @@ sub interpretCommandline
|
|||||||
# arrays in order to preserve the ordering. I parse both of these into hashes
|
# 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
|
# because those are useful to have later. After this I can access individual
|
||||||
# legends with $options{legend_hash}{curveid}
|
# legends with $options{legend_hash}{curveid}
|
||||||
for my $listkey (qw(legend curvestyle rangesize))
|
for my $listkey (qw(legend curvestyle rangesize every))
|
||||||
{
|
{
|
||||||
$options{"${listkey}_hash"} = {};
|
$options{"${listkey}_hash"} = {};
|
||||||
|
|
||||||
@ -812,6 +814,17 @@ sub mainThread
|
|||||||
$options{curvestyle}[$idx*2 + 1]);
|
$options{curvestyle}[$idx*2 + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(@{$options{every}})
|
||||||
|
{
|
||||||
|
# @{$options{every}} is a list where consecutive pairs are (curveID,
|
||||||
|
# every).
|
||||||
|
my $n = scalar @{$options{every}}/2;
|
||||||
|
foreach my $idx (0..$n-1)
|
||||||
|
{
|
||||||
|
addEveryOption($options{every}[$idx*2 ],
|
||||||
|
$options{every}[$idx*2 + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addCurveOption($_, 'axes x1y2') foreach (@{$options{x1y2}});
|
addCurveOption($_, 'axes x1y2') foreach (@{$options{x1y2}});
|
||||||
addCurveOption($_, 'axes x2y1') foreach (@{$options{x2y1}});
|
addCurveOption($_, 'axes x2y1') foreach (@{$options{x2y1}});
|
||||||
@ -1156,7 +1169,7 @@ sub updateCurveOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$curve->{options} = "$histoptions $usingoptions $titleoption $curve->{extraoptions}";
|
$curve->{options} = "$curve->{everyoptions} $histoptions $usingoptions $titleoption $curve->{extraoptions}";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getCurve
|
sub getCurve
|
||||||
@ -1180,6 +1193,9 @@ sub getCurve
|
|||||||
extraoptions => (!exists $options{curvestyle_hash}{$id} &&
|
extraoptions => (!exists $options{curvestyle_hash}{$id} &&
|
||||||
exists $options{curvestyleall}) ?
|
exists $options{curvestyleall}) ?
|
||||||
"$options{curvestyleall} " : ' ',
|
"$options{curvestyleall} " : ' ',
|
||||||
|
everyoptions => (!exists $options{every_hash}{$id} &&
|
||||||
|
exists $options{everyall}) ?
|
||||||
|
"every $options{everyall} " : ' ',
|
||||||
datastring => '',
|
datastring => '',
|
||||||
datastring_meta => [],
|
datastring_meta => [],
|
||||||
datastring_offset => 0}; # push a curve with no data and no options
|
datastring_offset => 0}; # push a curve with no data and no options
|
||||||
@ -1214,6 +1230,14 @@ sub addCurveOption
|
|||||||
$curve->{extraoptions} .= "$str ";
|
$curve->{extraoptions} .= "$str ";
|
||||||
updateCurveOptions($curve, $id);
|
updateCurveOptions($curve, $id);
|
||||||
}
|
}
|
||||||
|
sub addEveryOption
|
||||||
|
{
|
||||||
|
my ($id, $str) = @_;
|
||||||
|
|
||||||
|
my $curve = getCurve($id);
|
||||||
|
$curve->{everyoptions} .= "every $str ";
|
||||||
|
updateCurveOptions($curve, $id);
|
||||||
|
}
|
||||||
|
|
||||||
sub setCurveLabel
|
sub setCurveLabel
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user