Unexpected Exception is happened when draw a points series.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
zeus
Newbie
Newbie
Posts: 9
Joined: Wed May 23, 2007 12:00 am
Contact:

Unexpected Exception is happened when draw a points series.

Post by zeus » Mon Feb 22, 2010 4:11 am

To whom it may concern:

I am writing in connection with an unexpected exception when the teechart draw a points series.
The exception is like this:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
At: Steema.TeeChart.Styles.ValueList.get_Last()
At: Steema.TeeChart.Styles.Series.CalcFirstLastVisibleIndex()
At: Steema.TeeChart.Styles.CustomPoint.CalcFirstLastVisibleIndex()
At: Steema.TeeChart.Styles.Series.DrawSeries()
At: Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
At: Steema.TeeChart.Chart.InternalDraw(Graphics g)
At: Steema.TeeChart.TChart.Draw(Graphics g)
At: Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
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)

The my chart application has the Exception Catch Code at TeeChart Draw Code.
However that Catch Code can not catch this unexpected exception but other Catch Code in Main catch this thing.
I think that my codes don't have bugs about this exception. So, maybe This exception is happened by TeeChart's code.
Let me know whether you would like me to help this problem. I am looking forward to a solution.
Thank you.

ref:
The points series of my TeeChart has 38000 values. (I think there are so many values in one series.)
My code is like this:

addPointsValue(_pointSeries, dblCoordinateX, dblCoordinateY,
AppData.getColor(imaxValue, iminValue, dblValue), dblValue.ToString());
//AppData.getColor(double maxValue, double minValue, double value) is a function what gets a color by concerning the value's proportion between max and min)


private void addPointsValue(Points iobjPoints, double x, double y, Color ivalueColor, string istrLabel)
{
try
{
iobjPoints.Add(x, y, istrLabel, ivalueColor);
}
catch (Exception ex)
{
throw ex;
}

}

private Points _representiveSeries = null;

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

Re: Unexpected Exception is happened when draw a points series.

Post by Sandra » Mon Feb 22, 2010 10:19 am

Hello zeus,

I couldn't reproduce your problem using next simple code; please could you modify it, because we can reproduce exactly your exception here?

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Fill;
            Random rnd = new Random();
            for (int i = 0; i < 38000; i++)
            {
                AddPointsValue(points1, (double) i, rnd.Next(100), Color.Red, "red");
            }
        }
        private void AddPointsValue(Steema.TeeChart.Styles.Points ipoints, double x, double y, Color color, string p)
        {
            try{
            ipoints.Add(x, y, p, color);
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
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