Home forums Using CanvasJS Minimum interval for x axis

This topic contains 2 replies, has 2 voices, and was last updated by  lindevs 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14362

    lindevs
    Member

    Hi, using CanvasJS library I can set intervalType and interval for x axis. Is it possible to set minimum interval (minInterval) for x axis. When I set for example interval=1, it is good when x values are very small (1, 2, 3, 4, 5, etc.), but when I not set interval=1, x axis display double numbers (0.5, 1.5, etc.), when x values are only two or three.
    So I want set interval=auto, minInterval=1 and intervalType=hour. How I can do that?

    • This topic was modified 8 months ago by  lindevs.
    • This topic was modified 8 months ago by  lindevs.
    #14366

    Sanjoy
    Moderator

    Sorry lindevs as of now we don’t support minimum-interval. But you can achieve it by adding following two lines of code after calling chart.render() method.

        if(chart.axisX[0].get("interval") < 1){
        	chart.axisX[0].set("interval", 1);  
        }
    #14367

    lindevs
    Member

    chart.axisX[0].get(“interval”) always return value which was calculated when chart first time was created. When I myself set chart.axisX[0].set(“interval”, 1) when chart.axisX[0].get(“interval”) return correct value.

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

You must be logged in to reply to this topic.