consolidated some logic. no-op clarification

This commit is contained in:
Dima Kogan 2021-03-11 00:36:41 -08:00
parent 0dd24c2cba
commit 83139d7ad0

View File

@ -808,46 +808,23 @@ sub mainThread
print(PIPE "set view equal xy\n"); print(PIPE "set view equal xy\n");
} }
# For the specified values, set the legend entries to 'title "blah blah"' for my $what_options_prefix_suffix ( ['curvestyle', 'extraoptions', '', ' ' ],
if(@{$options{legend}}) ['every', 'everyoptions', 'every ', ' ' ],
['legend', 'title', '', '' ])
{ {
# @{$options{legend}} is a list where consecutive pairs are (curveID, my ($what, $options, $prefix, $suffix) = @$what_options_prefix_suffix;
# 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;
foreach my $idx (0..$n-1)
{
addOption($options{legend}[$idx*2 ],
'title',
$options{legend}[$idx*2 + 1]);
}
}
# add the extra curve options # @{$options{$what}} is a list where consecutive pairs are (curveID, style).
if(@{$options{curvestyle}}) if (@{$options{$what}})
{ {
# @{$options{curvestyle}} is a list where consecutive pairs are (curveID, my $n = scalar @{$options{$what}}/2;
# style).
my $n = scalar @{$options{curvestyle}}/2;
foreach my $idx (0..$n-1) foreach my $idx (0..$n-1)
{ {
addOption($options{curvestyle}[$idx*2 ], addOption($options{$what}[$idx*2 ],
'extraoptions', $options,
$options{curvestyle}[$idx*2 + 1] . " "); $prefix . $options{$what}[$idx*2 + 1] . $suffix);
} }
} }
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)
{
addOption($options{every}[$idx*2 ],
'everyoptions',
"every " . $options{every}[$idx*2 + 1] . " ");
}
} }
addOption($_, 'extraoptions', 'axes x1y2 ') foreach (@{$options{x1y2}}); addOption($_, 'extraoptions', 'axes x1y2 ') foreach (@{$options{x1y2}});