mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-06 06:21:16 +08:00
when streaming, don't plot unless there's new data
Ignore-this: ad73a697f4fdff7f269321aab8ea78f9 darcs-hash:20091206225531-0cb85-8951ac75504fb61c7ee2e9c7b20fae76f8fe4196.gz
This commit is contained in:
parent
d4ddf5f001
commit
8834e11a87
@ -189,11 +189,14 @@ sub mainThread {
|
|||||||
# regexp for a possibly floating point, possibly scientific notation number, fully captured
|
# regexp for a possibly floating point, possibly scientific notation number, fully captured
|
||||||
my $numRE = qr/([-]?[0-9\.]+(?:e[-]?[0-9]+)?)/o;
|
my $numRE = qr/([-]?[0-9\.]+(?:e[-]?[0-9]+)?)/o;
|
||||||
my $xlast;
|
my $xlast;
|
||||||
|
my $haveNewData;
|
||||||
|
|
||||||
while( $_ = ($dataQueue && $dataQueue->dequeue()) // <> )
|
while( $_ = ($dataQueue && $dataQueue->dequeue()) // <> )
|
||||||
{
|
{
|
||||||
if($_ ne "Plot now")
|
if($_ ne "Plot now")
|
||||||
{
|
{
|
||||||
|
$haveNewData = 1;
|
||||||
|
|
||||||
# parse the incoming data lines. The format is
|
# parse the incoming data lines. The format is
|
||||||
# x idx0 dat0 idx1 dat1 ....
|
# x idx0 dat0 idx1 dat1 ....
|
||||||
# where idxX is the index of the curve that datX corresponds to
|
# where idxX is the index of the curve that datX corresponds to
|
||||||
@ -217,6 +220,9 @@ sub mainThread {
|
|||||||
|
|
||||||
elsif($options{"stream"} && defined $xlast)
|
elsif($options{"stream"} && defined $xlast)
|
||||||
{
|
{
|
||||||
|
next unless $haveNewData;
|
||||||
|
$haveNewData = undef;
|
||||||
|
|
||||||
cutOld($xlast - $xwindow);
|
cutOld($xlast - $xwindow);
|
||||||
plotStoredData($xlast - $xwindow, $xlast);
|
plotStoredData($xlast - $xwindow, $xlast);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user