]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
update HPlot (partially, from daqtools)
authorHADES DAQ <hadaq@gsi.de>
Fri, 11 May 2018 11:23:09 +0000 (13:23 +0200)
committerHADES DAQ <hadaq@gsi.de>
Fri, 11 May 2018 11:23:09 +0000 (13:23 +0200)
hmon/Dmon.pm [new symlink]
hmon/HPlot.pm

diff --git a/hmon/Dmon.pm b/hmon/Dmon.pm
new file mode 120000 (symlink)
index 0000000..51d803c
--- /dev/null
@@ -0,0 +1 @@
+../../daqtools/perllibs/Dmon.pm
\ No newline at end of file
index b570357e1be9bd74446f3b80ff15722c1c52f5b3..114f40b733645bfdaf3e8aba6d731aa1f6053bd5 100755 (executable)
@@ -77,6 +77,7 @@ sub PlotInit {
   $p->{$name}->{showvalues} = $p->{$name}->{showvalues} || 0;
   $p->{$name}->{storable} = $p->{$name}->{storable} || 0;
   $p->{$name}->{plot_string} = ""; # to store the plot command
+  $p->{$name}{additional} = $p->{$name}{additional} || '';
 
   my $filename = $p->{$name}->{file};
   $filename =~ s%/%%;
@@ -135,6 +136,7 @@ sub PlotInit {
     plot_write($fh,"set autoscale fix");
     plot_write($fh,"set xtics autofreq"); #$p->{$name}->{entries}
     plot_write($fh,"set grid");
+    plot_write($fh,$p->{$name}{additional}) if $p->{$name}{additional};
     #     plot_write($fh,"set style fill solid 1.0");
     #plot_write($fh,"plot ",1);
     $p->{$name}->{plot_string} .= "plot ";
@@ -159,10 +161,11 @@ sub PlotInit {
     plot_write($fh, $p->{$name}->{plot_string});
   }
   elsif ($p->{$name}->{type} == TYPE_BARGRAPH) {
+    my $stacked = $p->{$name}{stacked}?' rowstacked':'';
     plot_write($fh,"set style fill   solid 1.00 border -1");
     plot_write($fh,"set grid noxtics ytics");
     plot_write($fh,"set boxwidth ".($p->{$name}->{curvewidth}||4)." absolute");
-    plot_write($fh,"set style histogram gap ".($p->{$name}->{bargap}||1));
+    plot_write($fh,"set style histogram  gap ".($p->{$name}->{bargap}||1).' '.$stacked);
     if (defined $p->{$name}->{bartitle} && scalar @{$p->{$name}->{bartitle}}) {
       plot_write($fh,"set xtics (",1);
       for (my $j=0; $j<scalar @{$p->{$name}->{bartitle}};$j++) {
@@ -173,6 +176,7 @@ sub PlotInit {
     }
     plot_write($fh,"set style histogram title offset character 0, 0, 0");
     plot_write($fh,"set style data histograms");
+    plot_write($fh,$p->{$name}{additional});
     #plot_write($fh,"plot ",1);
     $p->{$name}->{plot_string} .= "plot ";
     for (my $j=0; $j<$p->{$name}->{curves};$j++) {
@@ -219,13 +223,14 @@ sub PlotDraw {
     }
 
   if($p->{$name}->{type} == TYPE_HISTORY) {  
+    my $realentries = $p->{$name}{limitentries} || $p->{$name}->{entries};
     for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
-      for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
+      for(my $i=$p->{$name}->{entries}-$realentries; $i< $p->{$name}->{entries}; $i++) {
         if ($p->{$name}->{countup}) {
-          plot_write($p->{$name}->{fh},($i/$p->{$name}->{xscale})." ".$p->{$name}->{value}->[$j]->[$i]);
+          plot_write($p->{$name}->{fh},(($i-($p->{$name}->{entries}-$realentries))/$p->{$name}->{xscale})." ".$p->{$name}->{value}->[$j]->[$i]);
           }
         else {
-          plot_write($p->{$name}->{fh},(($i-$p->{$name}->{entries})/($p->{$name}->{xscale}||1))." ".($p->{$name}->{value}->[$j]->[$i]||0));
+          plot_write($p->{$name}->{fh},(($i-$realentries)/($p->{$name}->{xscale}||1))." ".($p->{$name}->{value}->[$j]->[$i]||0));
           }
         }
       plot_write($p->{$name}->{fh},"e");
@@ -233,9 +238,10 @@ sub PlotDraw {
     }
 
   if($p->{$name}->{type} == TYPE_BARGRAPH) {
+    my $realentries = $p->{$name}{limitentries} || $p->{$name}->{entries};
     #plot_write($p->{$name}->{fh}, $p->{$name}->{plot_string});
     for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
-      for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
+      for(my $i=$p->{$name}->{entries}-$realentries; $i< $p->{$name}->{entries}; $i++) {
         plot_write($p->{$name}->{fh},' '.$p->{$name}->{value}->[$j]->[$i]);
         }
       plot_write($p->{$name}->{fh},"e");
@@ -287,5 +293,9 @@ sub PlotFill {
   $p->{$name}->{value}->[$curve]->[$slot] = $value||0;
   }
 
+sub PlotLimitEntries {
+  my ($name,$entries) = @_;
+  $p->{$name}{limitentries} = $entries;
+  }
 
 1;