]> git.sesse.net Git - remoteglot/commitdiff
Compress the sparkline range a bit.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Dec 2022 14:14:55 +0000 (15:14 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Dec 2022 14:14:55 +0000 (15:14 +0100)
www/js/remoteglot.js

index b0c89cb750a8e179a0e87b03132da53fec7db000..c3de366309a6c6cd60289b551e4576515e531a7d 100644 (file)
@@ -1408,6 +1408,13 @@ let update_sparkline = function(data) {
                                if (score < min_score) min_score = score;
                                if (score > max_score) max_score = score;
                        }
+                       if (max_score - min_score < 100) {
+                               if (Math.abs(max_score) >= Math.abs(min_score)) {
+                                       max_score = min_score + 100;
+                               } else {
+                                       min_score = max_score - 100;
+                               }
+                       }
 
                        const h = scorespark.getBoundingClientRect().height;