You must be logged in to post your query.
Home › Forums › Chart Support › Points in the chart doesn't appear
Hi everyone, I have this problem with the JSP-Chart. When I try to show the chart It appears the structure but not the points inside.
window.onload = function () { var data = []; var dataSeries = { type: "line" }; var dataPoints = ${antennasPerModel}; dataSeries.dataPoints = dataPoints; data.push(dataSeries); var options = { exportEnabled: true, animationEnabled: true, title: { text: "Antenna" }, axisY: { includeZero: false, lineThickness: 1 }, data: data }; var chart = new CanvasJS.Chart("chartContainer", options); chart.render(); }
This is my code. The value that I received in dataPoints is : [{“y”:1,”x”:”model3″},{“y”:1,”x”:”model4″},{“y”:1,”x”:”model1″},{“y”:1,”x”:”model2″}];
What do you think could be the problem?
@samgonzul,
X-Value can be numeric or date-time. But in the dataPoints that you are passing x-values are string. Changing ‘x’ to label, i.e. [{"y":1,"label":"model3"},{"y":1,"label":"model4″},{"y":1,"label":"model1"},{"y":1,"label":"model2"}] should work fine.
[{"y":1,"label":"model3"},{"y":1,"label":"model4″},{"y":1,"label":"model1"},{"y":1,"label":"model2"}]
— Vishwas R Team CanvasJS
Thank you very much this works perfect!
You must be logged in to reply to this topic. Login/Register