I am currently tackling the task of calculating scores based on departments within groups. For simplicity, I will focus on just one group as an example.
Here is the data structure that I have:
const data = [{
"id": "cklt7ln1k0922o0sabjkk74m9",
"score": 80,
"count": 1,
"department": "Engineering",
"group": "Group one"
},
{
"id": "cklt7ln1k0922o0sabjkk74m9",
"score": 40,
"count": 1,
"department": "Executive",
"group": "Group one"
},
... (additional data entries)
];
My goal is to construct a data structure for a heatmap:
const heatmapData = [
{
row: 'Group one',
columns: [
{
name: 'Engineering',
averageScore: 70,
},
{
name: 'Supporting Department',
averageScore: 100,
},
.... (more unique departments)
]
}
]
I am struggling to find a straightforward solution for grouping data and performing calculations. Any assistance or guidance would be greatly appreciated. Thank you!