so I created a bar chart using Chart Js. So by using props I would like to change the labels of datasets one and two. The thing is my prop is set up in such a way due to the use in other graphs, that they have two objects inside. I only want to use, for example, object 2(in the object array) name for dataset two's label. I hope this makes sense.
I know you can use the map function to take all the object names, but I only want one..
datasets: [
{
label: props.data.map((o) => o.Name),
data: props.data.map((o) => o.Size),
borderColor: 'rgba(181, 156, 201, 1)',
backgroundColor: 'rgba(181, 156, 201, 0.75)'
},
{
label: props.data.map((o) => o.Name),
data: props.data.map((o) => o.Size),
borderColor: 'rgba(131, 90, 165, 1)',
backgroundColor: 'rgba(131, 90, 165, 0.75)',
},
What the set up above gives me

This is my useState set
setObjectOneIfo([InfoOne, InfoTwo])
And this is what I get in my console

Maybe I'm missing something. Any help would be largely appreciated.
datasets: [
{
label: props.data.map((o) => o.Name[1]), //Just put the index number you want behind name in square brackets
data: props.data.map((o) => o.Size),
borderColor: 'rgba(181, 156, 201, 1)',
backgroundColor: 'rgba(181, 156, 201, 0.75)'
},
{
label: props.data.map((o) => o.Name),
data: props.data.map((o) => o.Size),
borderColor: 'rgba(131, 90, 165, 1)',
backgroundColor: 'rgba(131, 90, 165, 0.75)',
}