intervalType: String

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.
Option: “number”,”millisecond” ,”second”,” minute”, “hour”, “day”, “month” ,”year”
Example: for interval as 15 minutes, set interval as 15, and set intervalType as “minute”,

Notes
  • If interval is not set, it is automatically calculated.
  • intervalType has to be always combined with interval property. If interval is not set, then intervalType is ignored.


var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 axisX:{
   interval: 3,
   intervalType: "month",
 },
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.



In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.

Comments 19

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

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

  3. 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!.

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

  5. 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[ ] ?

  6. 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?

In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.