fixed a bug in the drivegnuplot scripts. when a new curve is added, they now make sure to add all

the curves leading up to those. So if I'm trying to create curve 5, it'll create 0,1,2,3,4 if they
aren't there
This commit is contained in:
Dima Kogan 2009-11-04 18:20:51 -08:00
parent 8834e11a87
commit 0a2226594a

View File

@ -182,7 +182,7 @@ sub mainThread {
}
else
{
newCurve("", $str);
newCurve("", $str, undef, $y2idx);
}
}
@ -208,11 +208,7 @@ sub mainThread {
my $idx = $1;
my $point = $2;
# if this curve index doesn't exist, create curve up-to this index
while(!exists $curves[$idx])
{
newCurve("", "");
}
newCurve("", "", undef, $idx);
push @{$curves[$idx]}, [$xlast, $point];
}
@ -304,19 +300,42 @@ sub plotStoredData
sub newCurve()
{
my ($title, $opts, $newpoint) = @_;
my ($title, $opts, $newpoint, $idx) = @_;
# if this curve index doesn't exist, create curve up-to this index
if(defined $idx)
{
while(!exists $curves[$idx])
{
pushNewEmptyCurve();
}
}
else
{
# if we're not given an index, create a new one at the end, and fill it in
pushNewEmptyCurve();
$idx = $#curves;
}
if($title) { $opts = "title \"$title\" $opts" }
else { $opts = "notitle $opts" }
if( defined $newpoint )
{
push @curves, [" $opts", $newpoint];
$curves[$idx] = [" $opts", $newpoint];
}
else
{
$curves[$idx] = [" $opts"];
}
}
sub pushNewEmptyCurve
{
my $opts = "notitle ";
push @curves, [" $opts"];
}
}
sub usage {
print "Usage: $0 <options>\n";