Logarithmic scale with small numbers results bad axis labels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

Logarithmic scale with small numbers results bad axis labels

Post by Mike Jones » Thu Oct 16, 2008 8:59 pm

I have uploaded an example project called ChartLogrithamicBug It charts 7 point series. 6 are visible and have 1 point in each series. The 7th series has 2 points but the points are made invisible with a transparency = 100.

Here is a picture of what is charted


http://tinyurl.com/4rmvna

on the vertical axis, notice there is no tick marks. Zooming will make some tick marks show up.

1. Why is there no tick marks?
2. Why does panning only pan horizontally and not vertical?
3. How do you post pictures? I tried using the Img tag around the URL and it did not work.

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 Oct 17, 2008 9:29 am

Hi Mike,
1. Why is there no tick marks?
This is because values are very similar and there's no significative differences between them in a logarithimic scale. Same would happen with non-logarithmic axes and a series with a constant y value (all y values being the same), in that case the constant y value would be represented as a single label. In that case, logarithmic labels would be: 1, 10, 100, 1000, etc. Since chart values are lower than 1 no label is plotted. To solve this you can add code below to your example.

Code: Select all

						tChart1.Axes.Left.Labels.ValueFormat = "#,##0.00";
						tChart1.Axes.Left.Increment = 0.001;
2. Why does panning only pan horizontally and not vertical?
This is because left axis minimum and maximum are almost the same you could solve that manually setting axes min. and max. values:

Code: Select all

						tChart1.Axes.Left.SetMinMax(0, 5);
3. How do you post pictures? I tried using the Img tag around the URL and it did not work.
Putting image's URL between img tags works fine for me:

Image
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

Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

Not sure I understand

Post by Mike Jones » Fri Oct 17, 2008 12:40 pm

This is because values are very similar and there's no significative differences between them in a logarithimic scale. Same would happen with non-logarithmic axes and a series with a constant y value (all y values being the same), in that case the constant y value would be represented as a single label. In that case, logarithmic labels would be: 1, 10, 100, 1000, etc. Since chart values are lower than 1 no label is plotted. To solve this you can add code below to your example.
I am surprised that there are no labels on the left axis as you can see in the picture. Shouldn't there at least be 0.0, or the min/max values labeled? Instead it is just blank. That appears to be a bug to me.
Putting image's URL between img tags works fine for me:
Hmmm. Strange. I tried the url in between the tags and when I previewed it did not show the image. Maybe this is a limitation of preview.

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 Oct 17, 2008 1:27 pm

Hi Mike,
I am surprised that there are no labels on the left axis as you can see in the picture. Shouldn't there at least be 0.0, or the min/max values labeled? Instead it is just blank. That appears to be a bug to me.
I've added this (TF02013469) to the defect list to be investigated.
Hmmm. Strange. I tried the url in between the tags and when I previewed it did not show the image. Maybe this is a limitation of preview.
Preview also worked fine for me. Notice that I used images URL not entire Picasa page URL. For getting image's URL I right-clicked on it and chose "Copy Image Location" in FireFox, same feature exists in IE.
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

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

Post by Narcís » Tue Oct 21, 2008 1:03 pm

Hi Mike,

As a follow up to the issue above, we have found that a workaround is setting invisible series to non-Active instead of making it transparent, for example:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
			tChart1.Aspect.View3D = false;
			tChart1.Axes.Left.Logarithmic = true;
			tChart1.Axes.Left.MaximumOffset = 50;

			for (int i = 0; i < 7; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.Points());
			}

			tChart1[6].Active = false;
			//tChart1[6].Color = Color.Transparent;

			tChart1[0].Add(12, 0.080688476);
			tChart1[1].Add(14, 0.06408694);
			tChart1[2].Add(16, 0.050903320);
			tChart1[3].Add(18, 0.040405273);
			tChart1[4].Add(20, 0.0318860351);
			tChart1[5].Add(24, 0.020141601);
			tChart1[6].Add(11.4, 0);
			tChart1[6].Add(24.6, 1);
    }
Notice that labels problem may be solved using MaximumOffset as shown above.
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

Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

What is MaximumOffset?

Post by Mike Jones » Tue Oct 21, 2008 1:52 pm

What exactly is the purpose for MaximumOffset and what does it do?

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

Post by Narcís » Tue Oct 21, 2008 2:03 pm

Hi Mike

MaximumOffset is the amount of pixels that will be left as a margin at axis maximum position. This property is useful when you dont want the series to display points very close to axis boundaries.
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

Post Reply