Home forums Using CanvasJS Points in the chart doesn't appear

This topic contains 2 replies, has 2 voices, and was last updated by  samgonzul 3 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22156

    samgonzul
    Member

    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?

    #22158

    Vishwas R
    Keymaster

    @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.


    Vishwas R
    Team CanvasJS

    #22163

    samgonzul
    Member

    Thank you very much this works perfect!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.