0👍
✅
Your 2nd approach will work just fine if you change your definition of datData
from an object to an array:
var datData = [ ydata, xdata ];
myChart[0] = new Chart(ctx, {
type: barbarblackbar,
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: datData
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
Source:stackexchange.com