x: Number

Sets the x value. It determines the position of the dataPoint on X Axis. It can be numeric or a dateTime value. Values can be positive or Negative.


Default: null
Example: 10, 20, 30 ..
    new Date(2011, 08, 01)

Notes
  • If not provided, it will be set automatically set according to its index position on dataPoints Array.
  • When providing x as time stamp (which is integer), set xValueType as “dateTime”


var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 data: [{
  dataPoints: [
   {x:10, y : 10},

   ],

  },
 ]
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.

  Also See:    



If you have any questions, please feel free to ask in our forums.Ask Question

Comments 13

  1. can you please tell me how to hide x and y values in chat like in upper chart the value is showing like 40:65 i want to hide this 65

  2. Given an array of objects which I would like to use as my data points, Is there some way to specify which property of each object to use as the x and y values? I have an array of objects where each object looks like this:
    {
    time: ,
    total_failures: ,
    total_accounts:

    }

    I would like to create a plot with 2 data series, one showing time as the x axis and total_failures as the y axis, and the other showing time as the x axis and total_accounts as the y axis.

  3. Can you have x-axis labels with data points that are empty? For example, I want to load streaming data over 500 seconds. But I want 500 data points to be already established, just waiting for the data. It should look like the line is growing as more data comes in with each second. But the x-axis labels should remain static.

  4. any one could you please help me how to give the x value from xl sheet (I have the data in xl sheet, how i can give that data instead of giving manually in the code could you please help me )

  5. Hello, how can I display 2 days on the chart. I specify 2 dataPoints for today and for yesterday. But the problem is that today starts from end of yesterday on chart, How can I superimpose one day to another.

    My temp solution is the reset date to 1970-01-01 for today and yesterday dataPoints , but leave time. Any better solutions?

If you have any questions, please feel free to ask in our forums. Ask Question