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

Label valueAxis only on whole numbers when min and max are decimal

5 Answers 436 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Ross
Top achievements
Rank 1
Ross asked on 04 May 2016, 07:04 PM
I have line chart with 2 y axes (valueAxis) representing centimeters and inches. It's important that they align so that the cm value on one is equivalent to the inch value on the other. I have given the cm axis a min of 28 and a max of 55. This means the inch axis would have a min of 11.02 and a max of 21.65. But I want the inch axis to be labeled only on ticks representing whole numbers. Is there a way to do this? I've tried setting the label.skip to 1 and label.majorUnit to .98 so the first label would be at 12. I then created and label.visual function where I modified the label.majorUnit to 1 so the next label would be 13, but this didn't work. It ended up skipping the 13 and labeled the rest with decimals, which was confusing. I've tried a lot of things along these lines. Any suggestions? Thanks.

5 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 09 May 2016, 07:19 AM
Hi Ross,

You could use the visual setting of the value axis labels to control what is rendered. For your convenience here is a basic example.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ross
Top achievements
Rank 1
answered on 09 May 2016, 05:29 PM

Hi Iliana -

Your example stops labeling after the 12. How do I label 13, 14, etc. without labeling the decimal ticks?

thanks
Ross

0
Iliana Dyankova
Telerik team
answered on 11 May 2016, 08:11 AM
Hi Ross,

With the provided configuration from your first post (min, max, majorUnit etc.) 13 and 14 labels are not rendered (dojo). If you would like to keep this configuration but render different labels you should use custom JavaScript logic in the valueAxis.labels.visual function. A basic example is here

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ross
Top achievements
Rank 1
answered on 11 May 2016, 11:56 AM

Hi Iliana -

I'm not trying to round the decimal numbers. I'm trying to label only the non-decimal numbers. So if the numbers are 12.98, 13, 13.5, 13.6, 14, 15, 15.7, then only 13, 14 and 15 would get labels.

thanks
Ross

0
Iliana Dyankova
Telerik team
answered on 13 May 2016, 07:28 AM
Hi Ross,

The example in my first post demonstrates how to achieve this. However, as I mentioned with the with the labels configuration from your first post 13, 14 and 15 are not rendered. Could you please modify my example and demonstrate your exact setup - maybe I am missing something? Thank you in advance for your cooperation.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Ross
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Ross
Top achievements
Rank 1
Share this question
or