fixed incomplete last word with a burst spike causing burst heatmap steps to be misrepresented. closes #1655

This commit is contained in:
Jack 2021-07-22 17:43:01 +01:00
parent 00d8774203
commit 4dafb40cc5
2 changed files with 17 additions and 5 deletions

View file

@ -1554,8 +1554,10 @@ export function setBurstHeatmap(value, nosave) {
value = false;
}
config.burstHeatmap = value;
TestUI.applyBurstHeatmap();
if (!nosave) saveToLocalStorage();
if (!nosave) {
TestUI.applyBurstHeatmap();
saveToLocalStorage();
}
}
export function apply(configObj) {

View file

@ -796,6 +796,16 @@ export function applyBurstHeatmap() {
$("#resultWordsHistory .heatmapLegend").removeClass("hidden");
let min = Math.min(...TestStats.burstHistory);
let max = Math.max(...TestStats.burstHistory);
let burstlist = TestStats.burstHistory;
if (
TestLogic.input.getHistory(TestLogic.input.getHistory().length - 1)
.length !== TestLogic.words.getCurrent().length
) {
burstlist = burstlist.splice(0, burstlist.length - 1);
}
// let step = (max - min) / 5;
// let steps = [
// {
@ -819,13 +829,13 @@ export function applyBurstHeatmap() {
// class: 'heatmap-4'
// },
// ];
let median = Misc.median(TestStats.burstHistory);
let median = Misc.median(burstlist);
let adatm = [];
TestStats.burstHistory.forEach((burst) => {
burstlist.forEach((burst) => {
adatm.push(Math.abs(median - burst));
});
let step = Misc.mean(adatm);
// let step = Misc.stdDev(TestStats.burstHistory)/2;
// let step = Misc.stdDev(burstlist)/2;
let steps = [
{
val: 0,