intervalType is the unit of interval property. intervalType is by default set to “number” and hence you need to specify the interval type (eg “week”, “month”, etc) depending on the type of interval you intend to set. If required interval is 3 months, you need to provide interval as 3 and intervalType as “month”
Default: Automatically handled when interval property is not set. Defaults to “number” when you set the interval.var chart = new CanvasJS.Chart("container", { . . axisX:{ interval: 3, intervalType: "month", }, . . }); chart.render();
19 Comments
If I check the chart by day wise of any month, month is getting added by 1. How to solve the issue?
please check line no 45 of canvasjs.min.js “case “MM”:return G(u+1,2);” this should be “case “MM”:return G(u,2);”
In javascript month ranges from 0-11. Hence we add 1 to it while displaying.
https://canvasjs.com/forums/topic/month-problem/
Hii Sunil Urs:
I am using line chart of canvas javascript and I want to show my company total profit or loss in a month so amount can be positive or negative when i am trying put negative value it changes @0 point to some other point,can you solve my problem.
thanks in advance
Sunil,
Are looking for stripLines with value = 0. If you are looking for something else any fiddle or image depicting your problem/requirement will help us to understand better.
please have a demo with IntervalType : hour. For example , i want to draw a line from 9:20am 2014/2/9 -> 11:00 2014/2/10
zadwhite,
Please refer this example.
Is it possible to have custom label positioning?
I mean, I would like to identify tops and lows in a line, OHLC or candlestick chart, then put labels under them, and that’s all, no other labels.
Is this achievable with canvasjs?
(i’ve looked around in docs, but i’m not sure it’s possible.
You can do the same by setting valueFormatString to empty string and assigning label to selected dataPoints. Here is an example.
nice! intuitive also. thank you
I need to plot 1024 points in 1sec in a dynamic line chart. so that means i need to plot each point at 0.97 millisecond. Is there any way to programatically add each point with this precision. Currently javascript allows me to add 1 millisecond time to current time and plot. But I am unable to add time in decimals of milliseconds/microseconds!.
Do you have sample for using intervalType : hour and minute ?
Muhammad,
Check these fiddles for intervalType as hour and minute.
Can I display strings from my data on x-axis, as in I am showing quarterly data as Q1-2016, Q2-2016, Q3-2015, Q4-2015 or Week1-2016 and their corressponding data on y-axis. In my data I have already put these vaues but it is showing some random decimals on X-axis
Are you looking for label property?
Hi, I have 2 arrays which is dynamically being made with some algorithm and it all depends on the user inputs.
I want to plot each of the arrays in respective axis of the graph. That is call the 1 array(with dates) for the x-axis values and 1 array with numbers for y-axis.
So how do I call the 2 arrays in the datapoints[ ] ?
Elina,
In this case you have to parse the arrays according to data format. Here is an example.
I face issue with the same when there is only one element and i have fixed interval as 1 the it shows -1 and +1 on x axis .how to solve this?
Tejas,
To solve this issue you can set valueFormatString as
valueFormatString: " "
. Or by setting viewportMaximum and viewportMinimum you can resolve it.