Fix bug in weekly max/min graphs.

This commit is contained in:
Timothy Allen 2017-12-22 00:45:00 +02:00
parent 1aa5be56a7
commit aed0021900

View File

@ -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 :