1👍
It is undefined because you never set it. You have to configure the label
option in the dataset and not labels
, the dataset also does not have a labels option if I remember correctly.
new Chart('canvasId', {
type: 'line'
data: {
labels: ['a','b'],
datasets: [{
data: [4,7],
label: 'text that appears in the legend that is undefined right now'
}]
},
options: {}
})
- Chartjs-React-chartjs-2 – Each dataset needs a unique key
- Chartjs-How to give break line in data label
Source:stackexchange.com