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 5 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14459

    oneworld
    Member

    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[0].intervalType = “hour”;
    chart.axisX[0].interval = 2;
    chart.render();

    You will observe that those code lines have no impact on the interval settings.

    Can the interval and interval type be set programmatically?

    #14462

    Bivek Singh
    Moderator

    @oneworld

    You can change / set different properties of a chart using set method. In your case, using chart.axisX[0].set("interval", 4); will work.

    —-
    Bivek Singh

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.