1👍
✅
The charts label receives a string or an array of strings:
interface ChartData {
labels?: Array<string | string[]>;
datasets?: ChartDataSets[];
}
So you will put your array directly to the labels like so:
data={{
labels: arr,
datasets: [
{
label: "1st Dose",
data: [10, 20, 30, 50, 30],
backgroundColor: ["red", "orange", "yellow", "Green", "Blue"],
borderColor: ["rgba(255, 99, 132, 1)"],
borderWidth: 1,
},
],
}}
A live example for you to follow:
Source:stackexchange.com