use Bui;
my $html = do{ local $/; };
my $Isize :shared = 100;
my $Osize :shared = 20;
my $step : shared = 0;
my $img :shared;
Bui->init( $html, \$Isize, \$Osize, \$step, \$img );
my $gd = GD->new( ... );
while( 1 ) {
my @in = gendata( $Isize );
plotPoints( $gd, @in );
$img = $gd->png;
while( @in > $Osize ) {
my $discard = selectDiscard( @in );
splice @in, $discard, 1;
if( $step ) { ## If the "Replot at each step?" checkbox is checked
## clear old plot
$gd->drawRect( 0,0, $x, $y, white );
## Plot points minus the discarded one
plotpoints( @in );
## Update the image; the next time the browser polls for an update
## the revised image will be sent to the browser and be displayed
$img = $gd->png;
}
}
## clear old plot
$gd->drawRect( 0,0, $x, $y, white );
## Plot points minus the discarded one
plotpoints( @in );
## Update the image; the next time the browser polls for an update
## the revised image will be sent to the browser and be displayed
$img = $gd->png;
}