From 3f6d265295c59a757d4eb35b14b436f8a2f7ebae Mon Sep 17 00:00:00 2001 From: HADES DAQ Date: Fri, 11 May 2018 13:23:09 +0200 Subject: [PATCH] update HPlot (partially, from daqtools) --- hmon/Dmon.pm | 1 + hmon/HPlot.pm | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) create mode 120000 hmon/Dmon.pm diff --git a/hmon/Dmon.pm b/hmon/Dmon.pm new file mode 120000 index 0000000..51d803c --- /dev/null +++ b/hmon/Dmon.pm @@ -0,0 +1 @@ +../../daqtools/perllibs/Dmon.pm \ No newline at end of file diff --git a/hmon/HPlot.pm b/hmon/HPlot.pm index b570357..114f40b 100755 --- a/hmon/HPlot.pm +++ b/hmon/HPlot.pm @@ -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{$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; -- 2.43.0