Axis labels with consistent decimals

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Charles Cruden
Newbie
Newbie
Posts: 9
Joined: Wed Nov 18, 2009 12:00 am

Axis labels with consistent decimals

Post by Charles Cruden » Mon Jul 12, 2010 6:54 pm

Is there a way to get an axis to display tick labels with a consistent number of decimal places without having to examine the data range of the data and guess at what the code might do to lay things out?

We're plotting values on custom Axes with Automatic set to true. The problem we have currently is that while axes with a wide range of values look reasonably good, axes whose series have a small range of values (e.g. values fall between 1 and 3) have tick labels which go e.g. "1.1", "1.35", "1.5", "1.65", etc. The inconsistent number of decimal places staggers the labels and makes them look very bad. The format codes offered for AxisLabels.ValueFormat force you to choose between always presenting two decimal places (terrible for cases where we don't need them) or the above setting where trailing zeros are removed, and there doesn't seem to be a reasonable way to examine axis ranges or the difference between successive tick values to apply an appropriate ValueFormat before the labels are drawn. Am I missing something that would allow me to do this?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Axis labels with consistent decimals

Post by Sandra » Tue Jul 13, 2010 8:49 am

Hello Charles Cruden,

I suggest that instead of use two decimals you can use one decimal using Labels.ValueFormat with next lines of code:

Code: Select all

               tChart1.Axes.Bottom.Ticks.Visible = true;
               tChart1.Axes.Bottom.Labels.ValueFormat = "0.0";
Could you say us, if previous lines of code do as you want?
If these lines don't work like for you, Could you say exactly how you want the labels are?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply