IndexOutOfRangeException?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Chris
Newbie
Newbie
Posts: 9
Joined: Fri Nov 15, 2002 12:00 am

IndexOutOfRangeException?

Post by Chris » Thu Dec 18, 2003 4:08 pm

Hi everyone. I created a simple teechart that has an x and y axis. I plot the numbers below, but i receive an error.

fastLine1.Add(1.0,3.3691226157562149);
fastLine1.Add(2.0,3.3691226157562149);
fastLine1.Add(3.0,3.3691226157562149);
fastLine1.Add(4.0,3.3691226157562149);
fastLine1.Add(5.0,3.3691226157562153);

The points are really small, but I don't think it should be crashing. All of the settings for teechart are the default ones when you add the component to a C# project.

If anyone has any solutions for me or knows that this is an issue with teechart please let me know. I'm writing an application that needs very high precision, so this error behavior has been common for me so far. A solution is very important for me.

Thanks in advance,
Chris

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Dec 22, 2003 3:58 pm

Hi, Chris.

Tol avoid FP errors minimum axis range and axis increments are limited to 1.e-10 and 1.0e-12. If you're plotting smaller values then TeeChart will (when calculating axis limit) ignore them and use these two limiting values. Looking at your data it looks like the difference is on the scale of 1.0e-15 so they are well below these two limits (also close to double precision). Workarounds:

1) If you have NET sources, edit Axis.cs unit and change these two constants:
private const double minAxisIncrement = 0.000000000001;
private const double minAxisRange = 0.0000000001;
to smaller values. This is untested solution because you might end up with FP error.

2) Plot only difference, multiplied with appropriate decade factor. Example:

Code: Select all

      fastLine1.Add(1.0,149); 
      fastLine1.Add(2.0,149); 
      fastLine1.Add(3.0,149); 
      fastLine1.Add(4.0,149); 
      fastLine1.Add(5.0,153); 
      fastLine1.GetVertAxis.Title.Text = "3.3691226157562 + value x 1e-15"; 
Marjan Slatinek,
http://www.steema.com

Chris
Newbie
Newbie
Posts: 9
Joined: Fri Nov 15, 2002 12:00 am

Post by Chris » Tue Dec 23, 2003 4:40 pm

Thanks Marjan!!! It works now. I just used a quick fix with Math.Round(number,10); I just made sure that it would have 10 numbers maximum to the right of the decimal point to avoid future issues.

Thanks again,
Chris

Post Reply