Home Forums Chart Support Minimum interval for x axis

Minimum interval for x axis

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

    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 7 years, 8 months ago by lindevs.
    • This topic was modified 7 years, 8 months ago by lindevs.
    #14366

    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

    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.