Page 1 of 2
Issues with FastLine
Posted: Fri May 18, 2012 7:26 am
by 15662460
Hi,
We've just upgraded to latest version of TeeChart for .NET 2012 4.1.2012.05100. We're having issues with FastLine where the application crashes with following unhandled exception
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.PrepareFastLine()
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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The release notes says that FastLine.Clicked() bug has been fixed but I think it is still there. We use Click, MouseEnter and MouseLeave events for the FastLine.
Please respond as early as possible as now the application simply don't work with this latest release.
We can not change the line type to normal Line as we plot large data points and FastLine is only option to make it faster.
Re: Issues with FastLine
Posted: Fri May 18, 2012 8:05 am
by narcis
Hi Nitin,
Could you please attach a simple example project we can run "as-is" and let us know the exact steps we should follow to reproduce the problem here?
Thanks in advance.
Re: Issues with FastLine
Posted: Fri May 18, 2012 9:29 am
by 15662460
Hi Narcis,
I cannot send a sample example as the application is very complex. I've noticed that the exception fires when mouse hovers over a series. In MouseEnter event of FastLine, we capture X and Y and call Clicked(X,Y) method to find the index. At this time, it throws unhandled exception. In earlier version, this was happening randomly but in this latest release, it simply doesn't work and throws exception everytime.
Let me know how fast can you fix this issue, otherwise we have to go back to previous version. Even previous version has similar bugs in FastLine and crashes the application quite often.
Re: Issues with FastLine
Posted: Fri May 18, 2012 3:03 pm
by narcis
Hi Nitin,
Are you checking that Clicked doesn't return -1? Using the code snippet below Clicked is not working fine, always returns -1 but I don't get any exception. I have added this issue (TF02016192) to the bug list to be investigated. Is that what you get?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.FastLine fastLine1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastLine1.FillSampleValues();
fastLine1.MouseEnter += new EventHandler(fastLine1_MouseEnter);
}
private int x, y;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
}
void fastLine1_MouseEnter(object sender, EventArgs e)
{
int index = fastLine1.Clicked(x, y);
if (index != -1)
{
tChart1.Header.Text = index.ToString();
}
}
Thanks in advance.
Re: Issues with FastLine
Posted: Sun May 20, 2012 5:25 am
by 15662460
Hi Narcis,
Yes I do check if it returns -1. Even earlier it was not working fine but the amount of unhandled exception is now higher in this release and it makes the application completely unstable. Please let me know how fast you can provide the fix as this is very urgent and even previous versions have similar problems where the FastLine.Clicked method randomly crashes the application.
Re: Issues with FastLine
Posted: Mon May 21, 2012 10:26 am
by 15662460
Hi Narcis,
Any update? As I said it's very urgent for us and I would appreciate if you can tell me whether you can provide us the hotfix for this issue.
Nitin
Re: Issues with FastLine
Posted: Mon May 21, 2012 11:40 am
by 16062362
This is all along the same lines as the problems I've been reporting recently.
Whilst the crashes stopped for us with the latest update (dated May 15 I think), we've found it's no longer able to accurately determine what series we're clicking on. I suspect it's all related. When we create simple test apps they work fine but not in our main application.
As soon as I get a chance I plan to have a closer look and see if I can create a test app to demonstrate the issue. We've had to temporarily disable some of the functionality. Meanwhile if there is a hotfix, I'd be interested too.
Re: Issues with FastLine
Posted: Mon May 21, 2012 2:49 pm
by 16062362
Not sure if it helps as a temporary fix but I've overcome it by using some older code... Replace the Clicked function with this version...
#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;
}
Re: Issues with FastLine
Posted: Wed May 23, 2012 3:05 am
by 15662460
Hi,
Would you please answer ?
Re: Issues with FastLine
Posted: Wed May 23, 2012 11:57 am
by 10050769
Hello Nitin,
I can not provide a estimate date of when next maintenance release will be published, because last release is of 10 of May. I recommend you to be aware at this forum, our
RSS news feed,
twitter and
facebook accounts for new release announcements and what's implemented on them.
On the other hand, I suggest you use other mouse events as example MouseMove, MouseClick, MouseLeave of series . I have modified the Narcis code using MouseMove event:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.FastLine fastLine1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastLine1.LinePen.Width = 2;
fastLine1.FillSampleValues();
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int index = fastLine1.Clicked(e.X,e.Y);
if (index != -1)
{
tChart1.Header.Text = index.ToString();
}
}
Can you tell us if previous code works in your end?
Thanks,
Re: Issues with FastLine
Posted: Wed May 23, 2012 3:30 pm
by 15662460
Hi Sandra,
Thanks for your reply. I already did this but it doesn't stop unhandled exceptions and application crashes. Main problem is bugs in the FastLine series. We are facing these issues since last few releases but the FastLine series in this release is very unstable and it simply doesn't work. Every new release comes with more new bugs than fixes. The FastLine was working fine before.
Re: Issues with FastLine
Posted: Thu May 24, 2012 10:01 am
by 10050769
Hello Nitin,
Thanks for your reply. I already did this but it doesn't stop unhandled exceptions and application crashes. Main problem is bugs in the FastLine series. We are facing these issues since last few releases but the FastLine series in this release is very unstable and it simply doesn't work. Every new release comes with more new bugs than fixes. The FastLine was working fine before.
Using the codes we have suggested you, we don't have any problem with FastLine Series and it works in our end. For this, we need to reproduce the problems to fix these. For this reason, would be very helpful for us if you can try to arrange a simple project for us, because we can reproduce the exceptions appear when you use a Fastline and Mouse Events.
Thanks,
Re: Issues with FastLine
Posted: Tue May 29, 2012 1:14 pm
by 15662460
Hi Sandra,
I have attached sample project which re-produces the issue with FastLine. Run the project and click on 'Load Data' button. Zoom in and out few times and move your mouse in the chart to get the unhandled exception.
Re: Issues with FastLine
Posted: Wed May 30, 2012 2:07 pm
by 10050769
Hello Nitin,
Thanks for your project, finally we can reproduce your exception. Your problem occurs because the clicked metohd is activate,sometimes, before the series have been finished to draw in the canvas. For solve the problem, you only need use AutoRepaint=true in your methods populate and refresh series, as I have done in your project.
Can you tell us if your project works without problems?
Thanks,
Re: Issues with FastLine
Posted: Wed May 30, 2012 2:28 pm
by 15661493
I get the exact same thing, but under slightly different circumstances. Also, this is something that has changed in the recent past. My code used to work, but now fails dramtically.
Replicating this on my end can be done 100% of the time. If I have a chart on the screen and add a Bollinger Band study to it the chart will draw just fine. The problem occurs if I activate a Selection Tool on the chart. Once that is active, as soon as the mouse enters the chart client rectangle, the whole program blows up.
Like the other user, this is inside a fairly complex program that is loading live financial data, etc., so creating a sample sandbox where this happens is difficult. At the very least, some error trapping to catch NULL values or whatever inside the code could head this off. You can easily see the TCHART sub routines which are failing in the following Call Stack Report. A quick fix would sure be nice.
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.PREPAREFASTLINE()
AT STEEMA.TEECHART.STYLES.FASTLINE.DRAW()
AT STEEMA.TEECHART.STYLES.FASTLINE.CLICKED(INT32 X, INT32 Y)
AT STEEMA.TEECHART.STYLES.SERIES.CLICKED(POINT P)
AT STEEMA.TEECHART.CHART.CALCNEEDCLICKEDPART(POINT POS, BOOLEAN NEEDED)
AT STEEMA.TEECHART.CHART.CALCCLICKEDPART(POINT POS, CHARTCLICKEDPART& PART)
AT STEEMA.TEECHART.TOOLS.SELECTOR.GUESSCURSOR(MOUSEEVENTARGS E, CURSOR& C)
AT STEEMA.TEECHART.TOOLS.SELECTOR.MOUSEEVENT(MOUSEEVENTKINDS KIND, MOUSEEVENTARGS E, CURSOR& C)
AT STEEMA.TEECHART.CHART.BROADCASTMOUSEEVENT(MOUSEEVENTKINDS KIND, MOUSEEVENTARGS E, CURSOR& C)
AT STEEMA.TEECHART.CHART.BROADCASTMOUSEEVENT(MOUSEEVENTKINDS KIND, MOUSEEVENTARGS E, KEYS MODKEYS, 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.CONTROL.CONTROLNATIVEWINDOW.ONMESSAGE(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.CONTROL.CONTROLNATIVEWINDOW.WNDPROC(MESSAGE& M)
AT SYSTEM.WINDOWS.FORMS.NATIVEWINDOW.DEBUGGABLECALLBACK(INTPTR HWND, INT32 MSG, INTPTR WPARAM, INTPTR LPARAM)
AT SYSTEM.WINDOWS.FORMS.UNSAFENATIVEMETHODS.DISPATCHMESSAGEW(MSG& MSG)
AT SYSTEM.WINDOWS.FORMS.APPLICATION.COMPONENTMANAGER.SYSTEM.WINDOWS.FORMS.UNSAFENATIVEMETHODS.IMSOCOMPONENTMANAGER.FPUSHMESSAGELOOP(INTPTR DWCOMPONENTID, INT32 REASON, INT32 PVLOOPDATA)
AT SYSTEM.WINDOWS.FORMS.APPLICATION.THREADCONTEXT.RUNMESSAGELOOPINNER(INT32 REASON, APPLICATIONCONTEXT CONTEXT)
AT SYSTEM.WINDOWS.FORMS.APPLICATION.THREADCONTEXT.RUNMESSAGELOOP(INT32 REASON, APPLICATIONCONTEXT CONTEXT)
AT MICROSOFT.VISUALBASIC.APPLICATIONSERVICES.WINDOWSFORMSAPPLICATIONBASE.ONRUN()
AT MICROSOFT.VISUALBASIC.APPLICATIONSERVICES.WINDOWSFORMSAPPLICATIONBASE.DOAPPLICATIONMODEL()
AT MICROSOFT.VISUALBASIC.APPLICATIONSERVICES.WINDOWSFORMSAPPLICATIONBASE.RUN(STRING[] COMMANDLINE)
AT xxxx.MY.MYAPPLICATION.MAIN(STRING[] ARGS) IN 17D14F5C-A337-4978-8281-53493378C1071.VB:LINE 81
AT SYSTEM.APPDOMAIN._NEXECUTEASSEMBLY(RUNTIMEASSEMBLY ASSEMBLY, STRING[] ARGS)
AT SYSTEM.APPDOMAIN.EXECUTEASSEMBLY(STRING ASSEMBLYFILE, EVIDENCE ASSEMBLYSECURITY, STRING[] ARGS)
AT MICROSOFT.VISUALSTUDIO.HOSTINGPROCESS.HOSTPROC.RUNUSERSASSEMBLY()
AT SYSTEM.THREADING.THREADHELPER.THREADSTART_CONTEXT(OBJECT STATE)
AT SYSTEM.THREADING.EXECUTIONCONTEXT.RUN(EXECUTIONCONTEXT EXECUTIONCONTEXT, CONTEXTCALLBACK CALLBACK, OBJECT STATE, BOOLEAN IGNORESYNCCTX)
AT SYSTEM.THREADING.EXECUTIONCONTEXT.RUN(EXECUTIONCONTEXT EXECUTIONCONTEXT, CONTEXTCALLBACK CALLBACK, OBJECT STATE)
AT SYSTEM.THREADING.THREADHELPER.THREADSTART()