This is a migrated thread and some comments may be shown as answers.

Y axis value for chart are showing decimals

7 Answers 460 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Megharaj
Top achievements
Rank 1
Megharaj asked on 30 Mar 2016, 11:16 AM

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

 

 

7 Answers, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 04 Apr 2016, 07:12 AM
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
0
Megharaj
Top achievements
Rank 1
answered on 05 Apr 2016, 04:34 PM

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

 

Value of type TKChartAxis has no member 'majorTickInterval'

screenshot attached

0
Adrian
Telerik team
answered on 08 Apr 2016, 01:23 PM

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
0
Megharaj
Top achievements
Rank 1
answered on 08 Apr 2016, 04:47 PM

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

0
Adrian
Telerik team
answered on 13 Apr 2016, 12:30 PM
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
0
Megharaj
Top achievements
Rank 1
answered on 13 Apr 2016, 01:04 PM
Please find the side effect of majorTickIntervel = 3
0
Adrian
Telerik team
answered on 15 Apr 2016, 08:56 AM
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
Tags
Chart
Asked by
Megharaj
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Megharaj
Top achievements
Rank 1
Share this question
or