Page 1 of 1

Unexpected Exception is happened when draw a points series.

Posted: Mon Feb 22, 2010 4:11 am
by 13045248
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;

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

Posted: Mon Feb 22, 2010 10:19 am
by 10050769
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,