I'm looking to organize and display user scores by date in a matrix format where each user has only one score per date.
My desired matrix layout is as follows:
Date User1 User2 User3
2020-01-05 40 20 20
2020-01-03 40 30 -
2019-12-02 - 23 -
I have fetched the data from an API in the form of a JSON array consisting of objects with date, user, and score details. Is it possible to present this data in the format of the matrix mentioned above?
I attempted using *ngFor with various nesting options but couldn't achieve the desired outcome.
Should I restructure the data before attempting to display it?
Here's an example of the JSON data:
{
"results":[
{
"date":"2020-01-05",
"user":"user1",
"score":40
},
{
"date":"2020-01-05",
"user":"user2",
"score":20
},
{
"date":"2020-01-05",
"user":"user3",
"score":20
},
{
"date":"2020-01-03",
"user":"user1",
"score":40
},
{
"date":"2020-01-03",
"user":"user2",
"score":30
},
{
"date":"2019-12-02",
"user":"user2",
"score":23
}
]
}