0

I have the following situation: I want to create a stacked bar chart with chart.js in order to display messages written in a room per user. Each label on the x-axis shall represent one room while each stack of the bar shall represent one user in the room.

However I do know if there is a way to achieve this.

My current data for the chart looks like this:

        const data = {
        labels: ["room 1", "room 2"],
        datasets: [
            {
                {
                    label: 'Sebastian',
                    data: [1],
                    backgroundColor: ["#BA68C8", "#455A64"] ,
                },
                {
                    label: 'Louis',
                    data: [5],
                    backgroundColor: ["#BA68C8", "#455A64"] ,
                },
            },
            {
                {
                    label: 'Cole',
                    data: [6],
                    backgroundColor: ["#BA68C8", "#455A64"] ,
                },
                {
                    label: 'Charles',
                    data: [7],
                    backgroundColor: ["#BA68C8", "#455A64"] ,
                },
            },
        ]
        };

Has anyone an idea if there is a way to achieve this and if so how the data should look like?

schwaluck
  • 115
  • 9

0 Answers0