I'm a bit new to Chart.js. Is there a way to create a legend for each element in the dataset? What I'm trying to get is it to generate one legend for "Votes" and one for "2nd Votes".
var mybarChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Votes', '2nd Votes'],
datasets: [{
label: '# of Votes',
backgroundColor: "#000080",
data: [80, 50]
}]
},
options: {
legend: {
display: true,
position: 'bottom',
labels: {
fontColor: "#000080",
}
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});```