Y axis value for chart are showing decimals

8 posts, 0 answers
  1. Megharaj
    Megharaj avatar
    28 posts
    Member since:
    May 2015

    Posted 30 Mar Link to this post

    Dear team,

     

    Please have a look at the y-axis of the screenshot attached.

    Do we have an option to correct it and show some round figure values instead of decimals

     

     

  2. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 04 Apr Link to this post

    Hello, Megharaj,

    Thank you for contacting us.

    To show round numbers on the axis you should set its major tick interval. Consider the code below:
    yAxis.majorTickInterval = @3;

    I hope this helps.

    Regards,
    Adrian
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Megharaj
    Megharaj avatar
    28 posts
    Member since:
    May 2015

    Posted 05 Apr in reply to Adrian Link to this post

    when i use this piece of code it is showing below error:

     

    Value of type TKChartAxis has no member 'majorTickInterval'

    screenshot attached

  5. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 08 Apr Link to this post

    Hello, Megharaj,

    TKChartAxis is the base class for all axes in TKChart. You should cast your axis to TKChartNumericAxis and the set its majorTickInterval property. Consider the code:

    (yAxis as! TKChartNumericAxis).majorTickInterval = 3

    Regards,

    Adrian
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Megharaj
    Megharaj avatar
    28 posts
    Member since:
    May 2015

    Posted 08 Apr in reply to Adrian Link to this post

    actually my issue was that it was showing decimal point values on the y axis;

     

    this answer didnt solve the purpose.

    if i use minimumtickinterval / maximum tickinterval it will not stop showing the decimal values on the yaxis.

    if i use mintickinterval of 3 it can show 4.5 on y axis.

     

    i am lookin for right answer ASAP. its been so long since in raise this issue with screenshot

  7. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 13 Apr Link to this post

    Hi, Megharaj,

    You need to set majorTickInterval not minimum nor maximum interval. Major tick interval in numeric axis is calculated starting from the minimum value of the axis. If you have a numeric axis and its minimum value is not a decimal and the majortTickInterval is also a whole number then you shouldn't see decimal labels unless you zoom the axis. Since I am not able to reproduce this issue here, may be there is something specific in your project. Could you prepare a sample project that can be compiled and where this can be reproduced so I can investigate it further.

    Regards,
    Adrian
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Megharaj
    Megharaj avatar
    28 posts
    Member since:
    May 2015

    Posted 13 Apr Link to this post

    Please find the side effect of majorTickIntervel = 3
  9. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 15 Apr Link to this post

    Hello, Megharaj,

    This is not a side effect, this is the expected behavior. When you have an axis with range 300 and you set major tick interval of 3 you will get 100 labels. Your first screenshot shows an axis with range 12 that is why in my response I suggested to use major tick interval of 3, however you can set a different value for axes that have different range.

    Regards,
    Adrian
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner