From: Steinar H. Gunderson Date: Mon, 26 Dec 2022 14:14:55 +0000 (+0100) Subject: Compress the sparkline range a bit. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=4d96249116cab3219f4a36fd9bc97ac42dbf574b Compress the sparkline range a bit. --- diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index b0c89cb..c3de366 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -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;