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

DesiredTickCount not working as expected?

1 Answer 90 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Adnan
Top achievements
Rank 1
Adnan asked on 12 Apr 2017, 01:21 PM
I am trying to fix the number of ticks displayed in Linear Y-Axis to be only 5 ticks while I am maintaining the minimum and maximum values for each new plotted data point manually. The problem is even after setting DesiredTickCount property, Linear Y-Axis values still varying and it is not fixed to only 5 ticks. Am I using the right property? if not, then, how to achieve this?

Best Regards.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Apr 2017, 10:11 AM
Hi Adnan,

The DesiredTickCount property does what is says - it allows you to define a desired number of ticks for the axis. But keep in mind that this doesn't guarantee that number will be satisfied. The automatic range calculation takes into account different factors and it tries to display a reasonable step between the ticks (examples: 0.5, 0.2, 1, 300, 1500, 250, etc.). So, if you set the DesiredTickCount to 7, you could get also 6 or 8 labels, depending on the range of the axis.

If you want a concrete number of ticks you can calculate set the MajorStep property of the axis manually, based on the axis range. You can use the ActualRange property of the axis to get is range.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Adnan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or