👍:0
The bar data format is different from the pie data format. Also, you haven’t included your index in the textbox selector.
You need to change your handler to
$(document).on("click", "#drawChart", function (event) {
data = {
labels: [],
datasets: [
{
fillColor: "lightblue",
data: []
}
]
};
for (var i = 0; i < boxCounter ; i++) {
data.labels.push($("#whatever" + i).val() + "element");
data.datasets[0].data.push($("#whatever" + i).val())
}
var mybarChartLoc = new Chart(context).Bar(data, options);
});