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: nullvar chart = new CanvasJS.Chart("container", { . . data: [{ dataPoints: [ {x:10, y : 10}, ], }, ] . . }); chart.render();
13 Comments
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
Jayant,
Just set toolTipContent to “{x}”. For more details please refer toolTip section.
Thankx :)
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.
andrew,
Please checkout this example.
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.
Shaun,
Here is the JSFiddle. Hope this is the solution you are looking for.
That’s exactly what I wanted. Thank you.
One issue with this is that the data points will stop scrolling after the x-axis maximum is reached. Is there any way to start with a set amount of empty data points, but then when it reaches the maximum, start scrolling the x-axis to accommodate more data?
Nevermind, I did this before chart.render():
delete chart.options.axisX.maximum;
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 )
Usenaiah,
You can use SheetJS to get values from excel and pass it in the format which chart accepts.
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?