Y-axis autoscale issue.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Y-axis autoscale issue.

Post by BenW » Tue Nov 20, 2007 10:27 pm

Hi

If I configure my Y-axis to be automatic (autoscale), and I have samples that go between values of 0 and 1, the Y-axis labels will not be drawn correctly to indicate the range of the data (i.e. I expect something like 0 as the bottom label, and 1 as the top label, but instead it will draw one label in the middle of the Y-axis.

Is this a configuration issue? What can be done about this, so that autoscaling takes care of this labelling automatically?

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 21, 2007 10:37 am

Hi Ben,

By default TeeChart tries to draw as many labels as can be fitted in an axis provided they don't overlap.

It would be helpful if you read this thread. It's a pretty long thread (several pages) but covers almost all options.

Hope this helps!
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Wed Nov 21, 2007 4:39 pm

Hi Narcís.

Thanks for the information, however this is not an issue of label crowding, but really the opposite, where not enough labels are being drawn. If an axis has been configured as automatic, then I believe the internal alogorithm that is being executed to calculate the set of axis labels, should take into consideration the data range especially in the case where the data range falls between 2 whole numbers. Right now it seems that the 'automatic' algorithm looks at the data range and will only display one label, either in the middle of the axis, or toward the top of the axis. The end effect is that with only one label on the Y-axis, the customer is complaining that visually it is difficult to cross-correlate plotted points against their actual Y-axis value.

So here's the expectation:

A fully-labelled y-axis, regardless of the range from min to max; ie., with regular tick marks and appropriate labels along the entire range of the y-axis. So if it goes from 0 to 1, then the y-axis should be labelled with tick marks and values of 0.1, 0.2, 0.3, 0.4, etc. If the y-axis has a min-max of 0.005 to 0.006, then it similarly should be labelled 0.0051, 0.0052, 0.0053, 0.0054, etc.

Is this something that can be enabled now, or addressed in a future release?

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 22, 2007 9:05 am

Hi Ben,

To achieve what you request you can try setting axis increment to your desired value. Another option is using custom axis labels. You'll find an example of custom labels at All Features\Welcome !\Axes\Labels\Custom labels in the features demo available at TeeChart's program group.

If your problem persists please send us a simple example project we can run "as-is" to reproduce the issue here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Thu Nov 22, 2007 10:29 pm

Hi Narcís.

Well, as I was preparing the sample application to send on to you, after which I saw that the y-axis labels were being displayed as expected. Further investigation of our implementation revealed that the axis Increment property was the cause of our issue, because it was being defaulted to 1. From the sample application the default value was 0, and this setting gave us the y-axis labels that made sense, if the automatic property was set to true.

Can you confirm that setting the Increment property to 0, is supposed to have this effect, with a brief description of exactly what this property is supposed to control, if set to values other than 0...

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 23, 2007 8:20 am

Hi Ben,

As described in the help file:

Axis Increment is the minimum step between axis labels. It must be a positive number or DateTime value. TChart will use this value as the starting axis labels step. If there is not enough space for all labels, TChart will calculate a bigger one. You can use the DateTimeStep constant array for DateTime increments.

By default Increment is zero. So, this means that TeeChart tries to plot as many labels as possible in an axis. Logically, using zero increment would overlap labels so the automatically the minimum increment that doesn't overlap labels is used.
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Nov 23, 2007 2:46 pm

Hi Narcís,

One thing I did notice, is that all the y-axis labels are being drawn more reasonably by setting the increment to 0, but the label that should read 0 is not being drawn at all. So for example if the data range is -1 to +2, I will see labels calcaulated and drawn as -1, -.8, -.6, -.4, -.2, (space for, but no label for 0), .2, .4, .6, .8, 1, 1.2, 1.4, 1.6, 1.8, 2

Is there a way to force it to drawn the 0 label (and still have it drawn the other labels)?

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 23, 2007 3:24 pm

Hi Ben,

I'm afraid not unless you use custom labels. You could also play with axes MinimumOffset and MaximumOffset.
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Nov 23, 2007 3:29 pm

Narcís, is there a reason why it wouldn't be drawing the '0' label ?? It has allocated space for it, so why doesn't it just fill it in?

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 23, 2007 3:41 pm

Hi Ben,

Could you please send us a simple example project we can run "as-is" to reproduce the issue here and see if we can make the zero label appear?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Nov 23, 2007 3:58 pm

I have zipped up the files (SteemaIssue2.zip), and will upload them to your upload directory...

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 23, 2007 4:21 pm

Hi Ben,

Thanks for the example project.

Just commenting in the axis.Labels.ValueFormat line or setting it to axis.Labels.ValueFormat = "0.0"; solves the problem for me here.

Can you please try if it works fine at your end?

Thanks in advance!
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Fri Nov 23, 2007 5:29 pm

Yep that worked, but only for the specified data range.

If you change the code at the bottom from

double val = -1;
this.lineSeries1.Add(val, val/1);
val = 2;
this.lineSeries1.Add(val, val / 1);

to
double val = -1;
this.lineSeries1.Add(val, val/1000000);
val = 2;
this.lineSeries1.Add(val, val / 1000000);


and try it again, you'll see that the 0 doesn't appear again (NOTE: you'll also need to change the axis.Labels.ValueFormat)??

thanks,
Ben.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 26, 2007 10:23 am

Hi Ben,

Ok, setting ValueFormat as below works fine here.

Code: Select all

						axis.Labels.ValueFormat = "0.###############";
Best Regards,
Narcís Calvet / 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

BenW
Advanced
Posts: 119
Joined: Wed Aug 10, 2005 4:00 am

Post by BenW » Mon Nov 26, 2007 3:37 pm

Hi Narcís.

Yes that will work, but it does mean having to set the value format, each time for different value ranges. I guess there is no value format string that will produce a zero for any data range, and that are properly aligned, for axes that are configured as Automatic?

Ben.

Post Reply