I’m facing issue while adding dataPoints dynamically in Canvasjs.
Im adding my code below,
function BindChart(xAxis, secXAxis) {
var obj1 = JSON.parse(JSON.stringify(xAxis));
var obj2 = JSON.parse(JSON.stringify(secXAxis));
var obj3 = '[' + obj1 + ']';
//var obj4 = '[' + obj2 + ']';
var final = obj3;
//console.log('{ x: 2019, y: 2.30, label: "2019" },{ x: 2020, y: 5.60, label: "2020" },{ x: 2021, y: 3.50, label: "2021" },');
console.log(obj1);
console.log(obj2);
console.log(obj3);
var chart = new CanvasJS.Chart("chartContainer",
{
title: {
text: "A Combination of Column & Line Chart"
},
axisY: {
minimum: 0
},
data: [{
type: "column",
dataPoints: final
},
]
});
chart.render();
}
so please help me.`