Bar chart vertical axis values not starting at zero

4 posts, 1 answers
  1. Shawn
    Shawn avatar
    7 posts
    Member since:
    Dec 2012

    Posted 27 May 2014 Link to this post

    On a Cartesian chart (bar chart,) with certain values, the vertical axis is not starting at zero. Attached are two images. One shows the values formatted by default. The other is the values formatted as an integer. Note that the chart formatted as an integer is repeating values. The repetition is the ultimate problem, but I think it is the result of another problem (the vertical axis not starting at zero) or at least they are related in some manner.

    Any suggestions? 
  2. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 30 May 2014 Link to this post

    Hi Shawn,

    You can simply set the Minimum of the axis to 0. This behavior is by design as the chart is trying to show a more detailed axis range for the values it presents.

    Regards,
    Petar Marchev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Shawn
    Shawn avatar
    7 posts
    Member since:
    Dec 2012

    Posted 03 Jun 2014 in reply to Petar Marchev Link to this post

    I am not fond of this default behavior, but did what you said. I checked for my minimum possible value. If it was greater than or equal to zero, I set the minimum equal to zero. Otherwise, I allowed the default behavior. I could still see undesired results, but I believe they would be rare and negligible. 

    Thanks for your help.
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 04 Jun 2014 Link to this post

    Hi Shawn,

    I am not fond of this default behavior
    The chart behaves much like the excel chart, where the range is based on the values it presents. There is a notion of a delta - the delta is the difference between the max and min values. If the delta is less than six times smaller than the max - the chart includes the zero (if (max / delta < 6) IncludeZero). An exception is made when the delta is 0, which is the case you are interested in. In this case, it makes no sense to include the 0, because the value could be 10 billion. If later you add another item with value 10 billion and one, the chart will chose a range (10 bil, 10 bil + 1), so having the zero would make no sense.

    This is why by default if the delta is 0, we show a range ~(+0.5, -0.5) around the value. To make sure the zero is part of the range - the proper way to go is to set the Minimum to zero, this is by design.

    I could still see undesired results
    If you inform us about these, we might be able to help, or if you think that there is a bug, or a better way to display the range, please let us know.

    Regards,
    Petar Marchev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top