FastLine Issue

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

FastLine Issue

Post by Loz » Thu May 10, 2012 12:35 pm

I've just upgraded to the latest version of source and found there's a problem related to the FastLine type which we use.

When we click on a chart, we're seeing the following crash...

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Steema.TeeChart.Styles.ValueList.InsertChartValue(Int32 valueIndex, Double value)
at Steema.TeeChart.Styles.FastLine.DoDrawPoint(Int32 index, Int32 X, Int32 Y)
at Steema.TeeChart.Styles.FastLine.DrawValue(Int32 index)
at Steema.TeeChart.Styles.FastLine.Draw()
at Steema.TeeChart.Styles.FastLine.Clicked(Int32 x, Int32 y)

If we change the line type to 'Line', there's no problem. I noticed there was another reference to the same type of crash by someone but in their case they believed it was zoom related.

I've just downloaded the TeeChart demo to check out the FastLine example and that also crashes but in this case, it's as soon as the mouse is moved over the chart.

Is there a workaround / quick fix or should we use the Line type until the next update's released?

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Thu May 10, 2012 1:16 pm

Just as a further note, it could be related to firing of events.

Since removing the DblClick and Click events I'd assigned to the lines, it works. It could be that the person who had the same crash but when they zoomed had a related zoom event.
The demo app (FastLine example) may be crashing as a result of a mouseover event which is why it falls over as soon as the cursor moves over the chart.

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

Re: FastLine Issue

Post by Sandra » Fri May 11, 2012 1:41 pm

Hello Loz,

I can reproduce your problem using next simple example and last version of TeeChartFor.Net:

Code: Select all

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

        }
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.FastLine fast1 = new FastLine(tChart1.Chart);
            fast1.FillSampleValues();
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            Steema.TeeChart.Styles.Series s = tChart1[0];
            Steema.TeeChart.Styles.Series.ChangeType(ref s, typeof(Steema.TeeChart.Styles.Line));
        }
        private void button5_Click(object sender, EventArgs e)
        {
            tChart1.ShowEditor();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Steema.TeeChart.Styles.Series s = tChart1[0];
            Steema.TeeChart.Styles.Series.ChangeType(ref s, typeof(Steema.TeeChart.Styles.FastLine));
        }
Please, can you modify it so we can reproduce your problem exactly here?

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

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Tue May 15, 2012 11:40 am

Performing a simple test along the lines as you describe works fine.

Did the demo app crash for you when you moved the app over the chart?

Our app crashes with the following stack info:

> TeeChart.dll!Steema.TeeChart.Styles.ValueList.InsertChartValue(int valueIndex, double value) Line 493 C#
TeeChart.dll!Steema.TeeChart.Styles.FastLine.DoDrawPoint(int index, int X, int Y) Line 455 C#
TeeChart.dll!Steema.TeeChart.Styles.FastLine.DrawValue(int index) Line 613 C#
TeeChart.dll!Steema.TeeChart.Styles.FastLine.Draw() Line 357 + 0x18 bytes C#
TeeChart.dll!Steema.TeeChart.Styles.FastLine.Clicked(int x, int y) Line 267 C#
TeeChart.dll!Steema.TeeChart.Styles.Series.Clicked(System.Drawing.Point p) Line 6640 + 0x2d bytes C#
TeeChart.dll!Steema.TeeChart.Chart.CalcNeedClickedPart(System.Drawing.Point Pos, bool Needed) Line 2283 + 0x25 bytes C#
TeeChart.dll!Steema.TeeChart.Chart.DoMouseDown(bool IsDoubleClick, System.Windows.Forms.MouseEventArgs e, System.Windows.Forms.Keys Shift) Line 2453 + 0x1c bytes C#
TeeChart.dll!Steema.TeeChart.TChart.OnMouseDown(System.Windows.Forms.MouseEventArgs e) Line 3913 C#

I'll add more of the events and methods we use to the sample project in the hope I can find which combination of things causes the problem.

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Tue May 15, 2012 12:33 pm

In case it helps, here's some info about the example that crashes which is supplied as part of the .NET 2012 eval.

TeeChart Demo Folder\Steema TeeChart for .NET 2012 Evaluation 4.1.2012.02284\Examples\DemoProject\bin\ExecutableDemo\TeeChartNetExamples.exe

Example,
Fast Line Speed DrawAll Test

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Steema.TeeChart.Styles.ValueList.InsertChartValue(Int32 valueIndex, Double value)
at Steema.TeeChart.Styles.FastLine.DoDrawPoint(Int32 index, Int32 X, Int32 Y)
at Steema.TeeChart.Styles.FastLine.DrawValue(Int32 index)
at Steema.TeeChart.Styles.FastLine.Draw()
at Steema.TeeChart.Styles.FastLine.Clicked(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Series.CheckMouse(Cursor& c, Int32 x, Int32 y)
at Steema.TeeChart.Chart.CheckMouseSeries(Cursor& c, Int32 X, Int32 Y)
at Steema.TeeChart.Chart.DoMouseMove(Int32 x, Int32 y, Cursor& c)
at Steema.TeeChart.TChart.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

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

Re: FastLine Issue

Post by Sandra » Tue May 15, 2012 3:20 pm

Hello Loz,

Can you please download last maintenance release of 10 May and try again if your problem persist? If it persist please let me know. You can download it in download page

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

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Tue May 15, 2012 4:35 pm

All fixed! That's great, many thanks.

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Thu May 17, 2012 9:01 am

Our series click events don't seem to be firing properly. The sender object isn't actually the series that's supposed to be firing the event.

I've tried doing a small test but like last time the test app is working correctly.

I suspect this problem is related to the last one as it seemed that the crashing issue was event related. Is this new issue known?

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

Re: FastLine Issue

Post by Sandra » Thu May 17, 2012 12:26 pm

Hello Loz,

Could you explain step to step what are you doing after the exception appears, because we can try to reproduce your problem? And also, please tell us which O.S and VS are you using.

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

Loz
Newbie
Newbie
Posts: 9
Joined: Tue May 08, 2012 12:00 am

Re: FastLine Issue

Post by Loz » Mon May 21, 2012 2:45 pm

I'm using Visual Studio 2010 and Windows 7.

The problem is within the Clicked(int x, int y) function of fastline.cs

I've temporarily fixed the problem by using older code replacing that function.

#if WPF
public override int Clicked(double x, double y)
#else
public override int Clicked(int x, int y)
#endif
{
if ((firstVisible > -1) && (lastVisible > -1))
{
if (chart != null) chart.graphics3D.Calculate2DPosition(ref x, ref y, MiddleZ);

#if WPF
double OldX = 0;
double OldY = 0;
double tmpX, tmpY;
#else
int OldX = 0;
int OldY = 0;
int tmpX, tmpY;
#endif
Point p = new Point(x, y);

for (int t = firstVisible; t <= lastVisible; t++)
{
tmpX = CalcXPos(t);
tmpY = CalcYPos(t);
if ((tmpX == x) && (tmpY == y))
return t;
else if ((t > firstVisible) && Graphics3D.PointInLineTolerance(p, tmpX, tmpY, OldX, OldY, 3))
return t - 1;
OldX = tmpX;
OldY = tmpY;
}
}
return -1;
}

If I can find the time I'll try and track down the exact cause but effectively the code to detect if a valid trace is being clicked is failing. I think it's returning an index to a point in a series when it shouldn't necessarily do so.

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

Re: FastLine Issue

Post by Sandra » Tue May 22, 2012 3:51 pm

Hello Loz,

Thanks for your information. I am glad that you solve your problem and we consider your information for feature releases.

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