From 56c5fd85124c984f6462adc41b4880528fbac9c5 Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 31 May 2020 15:18:39 +0100 Subject: [PATCH] made sure both raw and wpm use the same axis scale --- public/js/script.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/script.js b/public/js/script.js index cfbece591..68e2acc1c 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -665,6 +665,15 @@ function showResult(difficultyFailed = false) { wpmOverTimeChart.data.datasets[1].data = rawHistory; + let maxVal = 0; + rawHistory.forEach(raw =>{ + if(raw >= maxVal){ + maxVal = raw; + } + }) + wpmOverTimeChart.options.scales.yAxes[0].ticks.max = maxVal; + wpmOverTimeChart.options.scales.yAxes[1].ticks.max = maxVal; + let errorsNoZero = [];