this is what I have written
const DataFromDataBase : IDataFromDataBase = {
label :['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets : [{datasetName:'Dataset1', data:[1,3,5,2,5,2,6]},{datasetName:'Dataset2', data:[4,6,5,2,5,2,6]} ],
}
const DatatoBarChartJS = {
label,
datasets : dataFromDataBase.datasets.map((dataset)=>{
{
label:dataset.datasetName
data : dataset.data
backgroundColor: 'rgba(255, 99, 132, 0.5)'
}
})
}
I expect to have below construction for DatatoBarChartJS
['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Dataset 1',
data:[1,3,5,2,5,2,6] ,
backgroundColor: 'rgba(255, 99, 132, 0.5)',
},
{
label: 'Dataset 2',
data:[4,6,5,2,5,2,6],
backgroundColor: 'rgba(53, 162, 235, 0.5)',
},
],
month names before datasets works fine but in datasets I get 2 empty arrays
it should be this enter image description here
but this is what I get enter image description here
why I cant produce what I expect