We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

2 surefire Ways to KILL your application using the Chart Control

Windows Chart Control, version:
5.202.0.25

Both the following will throw an unhandled ThreadExeption. Very ugly guys!

1) Set a range that creates 1 Division on the Primary X axis:

chartControl1.PrimaryXAxis.DateTimeRange =
new ChartDateTimeRange(now,
now.AddMinutes(10),
10,
ChartDateTimeIntervalType.Minutes);

IMHO You should be catching this potential at the time the range is set.
If ((end - start) / interval) < 2) then it's going to crash the control. Throw an exception at the setting of the DateTimeRange.


2) Set a small range, and then resize your control while its drawing.

This one is absolutely unacceptable!!!!!!!

Run the attached sample. Click the Start button, and resize the form.

You can also WATCH THE VIDEO (WMV) in the attached file.


Very ugly.


You should ALWAYS check that the graphics you draw are positive in length, else you'll get this garbage from .NET.

Unhandled exception,Overflow error., at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2)
at System.Drawing.Graphics.DrawLine(Pen pen, PointF pt1, PointF pt2)
at Syncfusion.Windows.Forms.Chart.Renderers.LineRenderer.Render(Graphics g)
at Syncfusion.Windows.Forms.Chart.ChartSeriesCollection.DrawSeries(Graphics g, IChartAreaHost chart)
at Syncfusion.Windows.Forms.Chart.ChartArea.Draw2D(PaintEventArgs e, ChartPaintFlags flags)
at Syncfusion.Windows.Forms.Chart.ChartArea.Draw(PaintEventArgs e, ChartPaintFlags flags)
at Syncfusion.Windows.Forms.Chart.ChartArea.Draw(PaintEventArgs e)
at Syncfusion.Windows.Forms.Chart.ChartControl._Paint(Graphics g, Rectangle r)
at Syncfusion.Windows.Forms.Chart.ChartControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(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),11/9/2007 2:07:14 PM
Unhandled exception,Parameter is not valid., at System.Drawing.Graphics.CheckErrorStatus(Int32 status)



2 Replies

ER ERobishaw November 9, 2007 09:43 PM UTC

Here's the attachement.




CrashIt.zip


JS Jeba S Syncfusion Team November 12, 2007 01:16 PM UTC

Hi ERobishaw,

Your Direct-Trac incident 38986 is updated. Please refer the Direct-Trac incident 38986 for details.

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.


Loader.
Live Chat Icon For mobile
Up arrow icon