}
else {
print $file $str."\n";
-# print $str."\n";
+ # print $str."\n";
}
if(defined $save) {$plotstring->{$save} .= $str;}
}
sub makeTimeString{
- return strftime("set label 100 \"%H:%M:%S\" at screen 0.02,0.02 left tc rgb \"#000044\" font \"monospace,8\"\n", localtime())
+ return strftime("set label 100 \"%H:%M:%S\" at screen 0.99,0.02 right tc rgb \"#000044\" font \"monospace,8\"\n", localtime())
}
sub setranges {
my $name = $c->{name};
- my $fn = "gnuplot 2>1";
+ my $fn = "gnuplot 2>&1";
+ #my $fn = "gnuplot";
#my $fh = new FileHandle ("|$fn") or die "error: no gnuplot";
open my $fh, "|$fn" or die "error: no gnuplot";
$fh->autoflush(1);
}
+sub PlotDrawFork {
+ my($name) = @_;
+ waitpid($p->{$name}->{pid},0) if $p->{$name}->{pid};
+ my $pid = fork;
+ unless ($pid) {PlotDraw($name);exit;}
+ $p->{$name}->{pid} = $pid;
+ $p->{$name}->{run}++;
+}
+
sub PlotDraw {
my($name) = @_;
+ if(!defined $p->{$name}) {
+ print "PlotDraw called with non existing plot name: \"$name\", typo? Exiting!\n";
+ exit;
+ }
if($p->{$name}->{buffer} && -e $p->{$name}->{file}."tmp.png") {
rename $p->{$name}->{file}."tmp.png", $p->{$name}->{file}.".png";
}
for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
for(my $i=$p->{$name}->{entries}-$realentries; $i< $p->{$name}->{entries}; $i++) {
plot_write($p->{$name}->{fh},' '.(($p->{$name}->{value}->[$j]->[$i]||0)/($p->{$name}->{yscale}||1))); #?? maybe without ||0
- }
- plot_write($p->{$name}->{fh},"e");
}
+ plot_write($p->{$name}->{fh},"e");
}
+ }
if($p->{$name}->{type} == TYPE_HEATMAP) {
sub PlotAdd {
my($name,$value,$curve) = @_;
+ if(!defined $p->{$name}) {
+ print "PlotAdd called with non existing plot name: \"$name\", typo? Exiting!\n";
+ exit;
+ }
$curve = 0 unless $curve;
+ #print Dumper $p;
push(@{$p->{$name}->{value}->[$curve]},$value||0);
shift(@{$p->{$name}->{value}->[$curve]});
sub PlotFill {
my($name,$value,$slot,$curve,$add) = @_;
+ if(!defined $p->{$name}) {
+ print "PlotFill called with non existing plot name: \"$name\", typo? Exiting!\n";
+ exit;
+ }
+
$curve = 0 unless $curve;
if($add) {
$p->{$name}->{value}->[$curve]->[$slot] += $value||0;