I have here the code of my chart, I am trying to display a chart however I am getting my values on label from another function (the output of that function is the var label3, if I will use label3 as my labels on the chart it will not work, but if I use the format like label2 it will work. My question is how can I make label3 be like the format of label2?
var ctx = document.getElementById('myChart').getContext('2d');
var label2 = ['28 Dec','29 Dec','30 Dec'];
var label3 = '28 Dec,29 Dec,30 Dec';
var data1 = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0';
var lineChartData = {
labels: label2,
datasets: [{
label: ' No. of clicks',
backgroundColor: "lightblue",
data: data1
}]
}
var myChart = new Chart(ctx, {
type: 'line',
data: lineChartData
});
I have made a code you could check it here