includeZero: Boolean

When includeZero is set to true, axisY sets the range in such a way that Zero is a part of it. But, whenever y values are very big and difference among dataPoints are hard to judge, setting includeZero to false makes axisY to set a range that makes the differences prominently visible.


Default: false
Example: true, false

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 axisY:{
  includeZero: true,

  },

 .
 .
});
chart.render();


In the below example change includeZero to true and see how the chart would look.
Try it Yourself by Editing the Code below.

  Also See:    



If you have any questions, please feel free to ask in our forums.Ask Question

Comments 7

  1. Hi,

    there is a bug with this option, which you can reproduce in this example by changing removing all datapoints and just insert e.g. {x:1,y:100000001} . Then the bar of that point is not displayed. If you increment the y value by one you will see that it will display the bar on each even number. The bug seems to occur only in a certain value range…

    Regards,
    Christian

    • Thanks for reporting the issue Christian. We are investigating the issue and we will get back to you soon.

    • Pravallika,

      Highlight zero on the axis is visible only for the charts with marker(all Line and Area charts). But you will get toolTip once you hover over dataPoint, and if required you can implement custom highlighter using mouseover.

  2. There is bug in bar chart:
    when set axisY.includeZero = false, if there is no data points in data, the axisY will display incorrectly.
    var chart = new CanvasJS.Chart(“chartContainer”,
    {
    title:{
    text: “Y axis not Starting from Zero”
    },
    axisY:{
    includeZero: false //try changing it to true
    },

    data: [
    {
    type: “bar”,
    dataPoints: [

    ]
    }
    ]
    });

If you have any questions, please feel free to ask in our forums. Ask Question