From aed00219001f6a7ad74ab6ab52c08091e46f70b9 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 22 Dec 2017 00:45:00 +0200 Subject: [PATCH] Fix bug in weekly max/min graphs. --- glucometer_graphs.pl | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/glucometer_graphs.pl b/glucometer_graphs.pl index 50bb063..d826d05 100644 --- a/glucometer_graphs.pl +++ b/glucometer_graphs.pl @@ -100,19 +100,6 @@ open( my $ifh, '<:encoding(UTF-8)', $input ) while ( my $row = <$ifh> ) { chomp( $row ); # Clean up the comments -# $row =~ s#\((Scan|Sensor)\)(; )?##i; -# $row =~ s#\(Blood\)(; )?##i; -# $row =~ s#Food \(.*?\)(; )?#:food:#i; -# $row =~ s#Rapid-acting insulin \((\d+).*?\)(; )?#:rapid-insulin$1:#i; -# $row =~ s#Long-acting insulin \((\d+).*?\)(; )?#:long-insulin$1:#i; -# # Collapse two shots of insulin into one diagram to avoid overlapping labels -# $row =~ s#(:(rapid|long)-insulin.*?:){2}#:insulin:#i; -# $row =~ s#:food:#{/: 🍎}#i; -# $row =~ s#:insulin.*?:#{/: 💉}#i; -# #$row =~ s#:rapid-insulin(.*?):#~{/: 💉}{-1{/:=10 Rapid}^{/:=10 $1}}#i; -# #$row =~ s#:long-insulin(.*)?:#{/: 💉}{-1{/:=10 Long}^{/:=10 $1}}#i; -# $row =~ s#:rapid-insulin(.*?):#{/: 💉}^{/:=10 $1}#i; -# $row =~ s#:long-insulin(.*)?:#{/: 💉}^{/:=10 $1}#i; my @comments; for my $row_comment ( $row =~ m#,"([^"]+?)"$# ) { for my $comment ( split /; /, $row_comment ) { @@ -283,10 +270,10 @@ foreach my $year ( sort keys %seen_weeks ) { push @data, qq(\$DataWeekMaxMin$label << EOD); @sortedlines = (); foreach my $time ( sort keys %{$week_intervals} ) { - push @sortedlines, qq($time $intervals->{$time}->{max} $intervals->{$time}->{min}); + push @sortedlines, qq($time $week_intervals->{$time}->{max} $week_intervals->{$time}->{min}); } @sortedlines = map { " $_" } @sortedlines; # indent data structure - push @data, sort @sortedlines; + push @data, join "\n", sort @sortedlines; push @data, qq(EOD); } } @@ -359,7 +346,6 @@ plot \$DataAvg using 1:2 smooth bezier # unset table - # Convert DataMaxMin from CSV to table set table \$DataMaxMinTable plot \$DataMaxMin using 1:2:3 with table @@ -718,4 +704,4 @@ close( $ofh ) #print GNUPLOT $gnuplot_data; #close(GNUPLOT); -# vim: set expandtab shiftwidth=4 softtabstop=4 tw=1000 : +# vim: set expandtab shiftwidth=4 softtabstop=4 tw=0 :