From 339c2f9a3d6550d16cbf1b8eed8f85148c4fca5d Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 22 May 2011 15:15:37 -0700 Subject: [PATCH] moved monotonicity checking into an outer loop --- bin/feedGnuplot | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/feedGnuplot b/bin/feedGnuplot index d1a8058..b165061 100755 --- a/bin/feedGnuplot +++ b/bin/feedGnuplot @@ -31,6 +31,9 @@ my %curveIndices = (); # now start the data acquisition and plotting threads my $dataQueue; +# latest domain variable present in our data +my $latestX; + my $streamingFinished : shared = undef; if($options{stream}) { @@ -421,6 +424,18 @@ sub mainThread /($numRE)/go or next; $domain[1] = $1; } + elsif( $options{monotonic} ) + { + if( defined $latestX && $domain[0] < $latestX ) + { + # the x-coordinate of the new point is in the past, so I wipe out all the data for this curve + # and start anew + clearCurves(); + } + else + { $latestX = $domain[0]; } + } + } else { @@ -595,17 +610,6 @@ sub setCurveLabel sub pushPoint { my ($curve, $xy) = @_; - - if($options{monotonic}) - { - if( @$curve > 1 && $xy->[0] < $curve->[$#{$curve}][0] ) - { - # the x-coordinate of the new point is in the past, so I wipe out all the data for this curve - # and start anew - splice( @$curve, 1 ); - } - } - push @$curve, $xy; }