fix: Fixes tooltip data inconsistency in heatmap

Removes unnecessary 'value' key in chart data config
Updates tooltip to correctly display 'Mood Count' using
'extract_data' object for improved accuracy
This commit is contained in:
Kumi 2024-11-28 15:13:03 +01:00
parent 68009c0865
commit 54be38232f
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -28,7 +28,6 @@ fetch("/mood/statistics/heatmap/values/")
} }
return 0; return 0;
}, },
value: "count",
}, },
scale: { scale: {
color: { color: {
@ -77,7 +76,7 @@ fetch("/mood/statistics/heatmap/values/")
const key = Object.keys(moodOptions).reduce((a, b) => Math.abs(moodOptions[a] - average) < Math.abs(moodOptions[b] - average) ? a : b); const key = Object.keys(moodOptions).reduce((a, b) => Math.abs(moodOptions[a] - average) < Math.abs(moodOptions[b] - average) ? a : b);
const mood = moodOptions[key]; const mood = moodOptions[key];
return `${date_str}<br>Mood Count: ${value}<br>Average Mood: ${mood.name}` return `${date_str}<br>Mood Count: ${obj.count}<br>Average Mood: ${mood.name}`
} }
} }
] ]