mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 15:08:45 +08:00
slimmed down the chart data
This commit is contained in:
parent
6ef90afcb9
commit
b369182d7a
2 changed files with 16 additions and 11 deletions
|
@ -735,12 +735,12 @@ let hoverChart = new Chart($(".pageAccount #hoverChart"), {
|
|||
radius: function (context) {
|
||||
var index = context.dataIndex;
|
||||
var value = context.dataset.data[index];
|
||||
return value.y <= 0 ? 0 : 3;
|
||||
return value <= 0 ? 0 : 3;
|
||||
},
|
||||
pointHoverRadius: function (context) {
|
||||
var index = context.dataIndex;
|
||||
var value = context.dataset.data[index];
|
||||
return value.y <= 0 ? 0 : 5;
|
||||
return value <= 0 ? 0 : 5;
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1877,16 +1877,21 @@ function showResult(difficultyFailed = false) {
|
|||
wpmOverTimeChart.options.scales.yAxes[1].ticks.min = 0;
|
||||
}
|
||||
|
||||
let errorsNoZero = [];
|
||||
// let errorsNoZero = [];
|
||||
|
||||
// for (let i = 0; i < errorsPerSecond.length; i++) {
|
||||
// errorsNoZero.push({
|
||||
// x: i + 1,
|
||||
// y: errorsPerSecond[i].count,
|
||||
// });
|
||||
// }
|
||||
|
||||
let errorsArray = [];
|
||||
for (let i = 0; i < errorsPerSecond.length; i++) {
|
||||
errorsNoZero.push({
|
||||
x: i + 1,
|
||||
y: errorsPerSecond[i].count,
|
||||
});
|
||||
errorsArray.push(errorsPerSecond[i].count);
|
||||
}
|
||||
|
||||
wpmOverTimeChart.data.datasets[2].data = errorsNoZero;
|
||||
wpmOverTimeChart.data.datasets[2].data = errorsArray;
|
||||
|
||||
let kps = keypressPerSecond.slice(Math.max(keypressPerSecond.length - 5, 0));
|
||||
|
||||
|
@ -1917,7 +1922,7 @@ function showResult(difficultyFailed = false) {
|
|||
let chartData = {
|
||||
wpm: wpmHistory,
|
||||
raw: rawWpmPerSecond,
|
||||
err: errorsNoZero,
|
||||
err: errorsArray,
|
||||
};
|
||||
|
||||
if (testtime > 122) {
|
||||
|
@ -4868,12 +4873,12 @@ let wpmOverTimeChart = new Chart(ctx, {
|
|||
radius: function (context) {
|
||||
var index = context.dataIndex;
|
||||
var value = context.dataset.data[index];
|
||||
return value.y <= 0 ? 0 : 3;
|
||||
return value <= 0 ? 0 : 3;
|
||||
},
|
||||
pointHoverRadius: function (context) {
|
||||
var index = context.dataIndex;
|
||||
var value = context.dataset.data[index];
|
||||
return value.y <= 0 ? 0 : 5;
|
||||
return value <= 0 ? 0 : 5;
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue