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 else
{ {
newCurve("", $str); newCurve("", $str, undef, $y2idx);
} }
} }
@ -208,11 +208,7 @@ sub mainThread {
my $idx = $1; my $idx = $1;
my $point = $2; my $point = $2;
# if this curve index doesn't exist, create curve up-to this index newCurve("", "", undef, $idx);
while(!exists $curves[$idx])
{
newCurve("", "");
}
push @{$curves[$idx]}, [$xlast, $point]; push @{$curves[$idx]}, [$xlast, $point];
} }
@ -304,20 +300,43 @@ sub plotStoredData
sub newCurve() 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" } if($title) { $opts = "title \"$title\" $opts" }
else { $opts = "notitle $opts" } else { $opts = "notitle $opts" }
if( defined $newpoint ) if( defined $newpoint )
{ {
push @curves, [" $opts", $newpoint]; $curves[$idx] = [" $opts", $newpoint];
} }
else else
{ {
push @curves, [" $opts"]; $curves[$idx] = [" $opts"];
} }
} }
sub pushNewEmptyCurve
{
my $opts = "notitle ";
push @curves, [" $opts"];
}
sub usage { sub usage {
print "Usage: $0 <options>\n"; print "Usage: $0 <options>\n";
print <<OEF; print <<OEF;