Home › forums › Using CanvasJS › How To Set The IntervalType and Interval Programmatically
This topic contains 1 reply, has 2 voices, and was last updated by Bivek Singh 2 years, 1 month ago.
The JSFiddle at http://jsfiddle.net/tsjLdr1h/10/ provides an example of how to configure the Interval and Interval type while creating a new chart.
Is it possible to do the same programmatically through the chart api?
E.g. in the JSFiddle above, comment out the interval and interval settings lines (line 7 and 8), then add the following lines at the end, after the chart.render() line (after line 33):
chart.axisX.intervalType = “hour”;
chart.axisX.interval = 2;
You will observe that those code lines have no impact on the interval settings.
Can the interval and interval type be set programmatically?
You can change / set different properties of a chart using set method. In your case, using chart.axisX.set("interval", 4); will work.
You must be logged in to reply to this topic.