Page 1 of 1

OutOfMemoryException thrown in TeeChart

Posted: Wed Nov 30, 2011 7:30 am
by 15659548
Hi,

I got the following exception followed by a big Red Cross in the chart when i am updating the FastLine with few hundreds of items and labels continuously. Is there any limit for the number of labels allowed in Teechart?
(I don't have any sample application that can duplicate the issue yet.)


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.ArrayList.set_Capacity(Int32 value)
at System.Collections.ArrayList.EnsureCapacity(Int32 min)
at System.Collections.ArrayList.Add(Object value)
at Steema.TeeChart.Axis.DrawAxisLabel(ChartFont f, Int32 x, Int32 y, Int32 angle, String st, TextShape format, Boolean isTitle)
at Steema.TeeChart.Axis.DrawAxisLabel(ChartFont f, Int32 x, Int32 y, Int32 angle, String st, TextShape format)
at Steema.TeeChart.Axis.DrawAxisLabel(Int32 x, Int32 y, Int32 angle, String st, TextShape labelItem)
at Steema.TeeChart.Axis.AxisDraw.DrawThisLabel(Int32 labelPos, String tmpSt, TextShape labelItem)
at Steema.TeeChart.Axis.AxisDraw.AxisLabelsSeries(Rectangle rect)
at Steema.TeeChart.Axis.AxisDraw.Draw(Boolean calcPosAxis)
at Steema.TeeChart.Axis.Draw(Boolean calcPosAxis)
at Steema.TeeChart.Axes.Draw(Graphics3D g)
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)

Re: OutOfMemoryException thrown in TeeChart

Posted: Thu Dec 01, 2011 9:29 am
by 10050769
Hello jdsu,

I have made a simple project and it works fine in last version of TeeChart.Net and your exception doesn't appears:

Code: Select all

  public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.FastLine fastline1;
        private void InitializeChart()
        {
            fastline1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            fastline1.FillSampleValues(1000);
            tChart1.Axes.Bottom.Labels.Items.Clear();
            for (int i = 0; i < fastline1.Count; i  )
            {
                tChart1.Axes.Bottom.Labels.Items.Add(fastline1.XValues[i]*10, (fastline1.XValues[i]*10).ToString());
            }

        }
        private void button1_Click(object sender, EventArgs e)
        {
          //  fastline1.Clear();
            
            fastline1.FillSampleValues(1000);
            tChart1.Axes.Bottom.Labels.Items.Clear();

            for (int i = 0; i < fastline1.Count; i  )
            {
                tChart1.Axes.Bottom.Labels.Items.Add(fastline1.XValues[i], (fastline1.XValues[i]).ToString());
            }
        }
Can you please, check if previous code works fine for you? If previous code doesn't work as you want and in it doesn't appears your problem, please modify code, because we try to reproduce the problem here and we can help you to solve it.

Thanks,