From 82c540b1c17c533d8233af31a9de205be24200b7 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 8 Jun 2018 20:03:49 +0200 Subject: [PATCH] HPlot update for heatmaps --- hmon/HPlot.pm | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/hmon/HPlot.pm b/hmon/HPlot.pm index 114f40b..0d8124f 100755 --- a/hmon/HPlot.pm +++ b/hmon/HPlot.pm @@ -83,12 +83,13 @@ sub PlotInit { $filename =~ s%/%%; $storefile->{$name} = "/dev/shm/".$name.'-'.$p->{$name}->{curves}.'-'.$p->{$name}->{entries}.'-'.$filename.'.store'; - - foreach my $i (0..($c->{entries}-1)) { - for my $j (0..($c->{curves}-1)) { - push(@{$p->{$name}->{value}->[$j]},0) ; + unless ($p->{$name}{noinit}) { + foreach my $i (0..($c->{entries}-1)) { + for my $j (0..($c->{curves}-1)) { + push(@{$p->{$name}->{value}->[$j]},0) ; + } } - } + } if($p->{$name}->{storable}) { if (-e $storefile->{$name}) { @@ -194,7 +195,7 @@ sub PlotInit { plot_write($fh,"set palette rgbformulae 22,13,-31"); if ($p->{$name}->{showvalues} == 0) { #plot_write($fh,"splot '-' matrix with image"); - $p->{$name}->{plot_string} .= "splot '-' matrix with image \n" + $p->{$name}->{plot_string} .= "plot '-' matrix with image \n" } else { #plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'"); @@ -251,21 +252,22 @@ sub PlotDraw { if($p->{$name}->{type} == TYPE_HEATMAP) { for(my $j=0; $j<$p->{$name}->{curves}; $j++) { for(my $i=0; $i< $p->{$name}->{entries}; $i++) { - plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]||0)." ",1); + plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]//"NaN")." ",1); } plot_write($p->{$name}->{fh}," ",0); } plot_write($p->{$name}->{fh},"e"); plot_write($p->{$name}->{fh},"e"); - - for(my $j=0; $j<$p->{$name}->{curves}; $j++) { - for(my $i=0; $i< $p->{$name}->{entries}; $i++) { - plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]||0)." ",1); + if ($p->{$name}{showvalues}) { + for(my $j=0; $j<$p->{$name}->{curves}; $j++) { + for(my $i=0; $i< $p->{$name}->{entries}; $i++) { + plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]||0)." ",1); + } + plot_write($p->{$name}->{fh}," ",0); } - plot_write($p->{$name}->{fh}," ",0); + plot_write($p->{$name}->{fh},"e"); + plot_write($p->{$name}->{fh},"e"); } - plot_write($p->{$name}->{fh},"e"); - plot_write($p->{$name}->{fh},"e"); } -- 2.43.0