I am trying to put to work a solution that uses chart.js but it is not accepting my values for the labels and dataset.label parameters.
For the labels parameter I am catching the values in an array and then passing the array to the parameter, take a look to the code so you can see what I am doing:
chartX.map(function (item) {
return '"' + item + '"';
}).join(", ");
yAxis = chartY.join(', ');
console.log(chartX); // <--- ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: chartX,
datasets: [{
label: 'Försäjlning',
data: yAxis
}]
}
the chartX is an array and it gets formmated inside a map. The result you can see in the console.log(chartX). For the chartY array I just join it with ',' and save it in the yAxis variable. This one is also giving me the expected values when I do a console.log.
The problem is that chart js seems don't like the arrays because is not showing anything, not even error messages.
Has someone encounter some similar problem? What can be wrong?
Meny thanks!!!