JavaScript Reduce to group by object

I have an object as following, I would like to plot it using chartjs.org after aggregating data, so I am seeing totals for each class by month and year.

[
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "K",
    "count": 10
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "1",
    "count": 14
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "2",
    "count": 14
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "3",
    "count": 10
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "4",
    "count": 15
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "5",
    "count": 13
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "6",
    "count": 6
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "7",
    "count": 3
  },
  {
    "date": "2022-10-01T04:00:00.000Z",
    "class": "8",
    "count": 3
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G1A",
    "count": 10
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G1B",
    "count": 7
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G2A",
    "count": 63
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G2B",
    "count": 8
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G3",
    "count": 1
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G4",
    "count": 6
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "G6",
    "count": 5
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "7",
    "count": 2
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "K",
    "count": 1
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "4",
    "count": 15
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "5",
    "count": 15
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "1",
    "count": 8
  },
  {
    "date": "2022-11-01T04:00:00.000Z",
    "class": "2",
    "count": 5
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G1A",
    "count": 33
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "7",
    "count": 12
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G1B",
    "count": 4
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G3",
    "count": 5
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G2B",
    "count": 8
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G2A",
    "count": 13
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G6",
    "count": 10
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "G4",
    "count": 3
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "6",
    "count": 9
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "8",
    "count": 7
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "9",
    "count": 5
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "3",
    "count": 10
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "1",
    "count": 27
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "K",
    "count": 20
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "4",
    "count": 21
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "5",
    "count": 30
  },
  {
    "date": "2022-12-01T05:00:00.000Z",
    "class": "2",
    "count": 20
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G1B",
    "count": 2
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G3",
    "count": 13
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G2B",
    "count": 33
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G2A",
    "count": 42
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G4",
    "count": 16
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G6",
    "count": 17
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "G1A",
    "count": 34
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "K",
    "count": 24
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "6",
    "count": 45
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "7",
    "count": 22
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "8",
    "count": 7
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "9",
    "count": 7
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "1",
    "count": 32
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "2",
    "count": 40
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "5",
    "count": 46
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "3",
    "count": 21
  },
  {
    "date": "2023-01-01T05:00:00.000Z",
    "class": "4",
    "count": 45
  }
]

I can get labels using following:

aggregated_attendance_labels = aggregated_attendance_filtered.map((x) => {
        const month = x["date"].getMonth()+1;
        const year = x["date"].getFullYear();
        return `${month}-${year}`;
    });

and dataset is not quite looking like chartjs wants it, how do I adjust the following?

var result = aggregated_attendance.reduce((acc, item)  => {
        let key = item["class"];
        if (!acc[key]) {
          acc[key] = {
            "label": key,
            "data": [item["count"]]
          }
        }
        acc[key]["data"].push(item["count"]);
        return acc;
      }, Object.create(null));

I believe I need to match it with the following format:

https://www.chartjs.org/docs/latest/configuration/animations.html