$ git clone https://librecgm.ion.nu/librecgm.git
commit 39fb31c892a2c742ad248a4c9d4afdf7622e4773
Author: Alicia <...>
Date:   Mon Sep 20 19:38:18 2021 +0200

    Label values of high and low points in graphs.

diff --git a/img.c b/img.c
index 62006c2..caac43b 100644
--- a/img.c
+++ b/img.c
@@ -187,5 +187,25 @@ void drawgraph(struct img* img, int h, int listlen, int* list)
                 25+i*(img->w-25)/listlen,         img->h-list[i]*img->h/h};
     lastvalid=i;
     drawline(img, line, &line[2], 0xff0000);
+    // Label values of high and low points
+    char min=1;
+    char max=1;
+    int j;
+    for(j=1; j<10 && i-j>=0; j++) // Before
+    {
+      if(list[i-j]>=list[i]){min=0;} // >= and <= here because we only want the first value of a plateau
+      if(list[i-j]<=list[i]){max=0;}
+    }
+    for(j=1; j<10 && i+j<listlen; j++) // After
+    {
+      if(list[i+j]>list[i]){min=0;}
+      if(list[i+j]<list[i]){max=0;}
+    }
+    if(min||max)
+    {
+      char txt[16];
+      sprintf(txt, "%.1f", ((double)list[i])/10);
+      text(img, 25+i*(img->w-25)/listlen, img->h-list[i]*img->h/h, txt);
+    }
   }
 }