Urngent:Memory issue while surface graph plot

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Alias
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2014 12:00 am

Urngent:Memory issue while surface graph plot

Post by Alias » Tue Jan 13, 2015 9:40 am

We are using Teechart graph control for a .Net 4.0(Winform) desktop application development.
We are facing problems in plotting surface graph.

Issues:
1. Plotting surface graph for 65 files(.csv). Each file has 3000 000 points. Each point is of double data type.
We are passing file data as a data table.
In terms of data table, 65 data table, average row count =>1200, Column count => 3, in each table.
After plotting some table points, it throws out of memory exception.
We are using Teechart's "Surface" API --> Surface.Add

2. An application going into not responding state with large data.

3. Is there any API to plot point as fast as possible similar to FastLine. If yes, please provide the version details.

System Information (Desktop)
OS: Windows 7, 32 bit
Processor: Intel i5-3470 CPU, 3.20 GHZ
RAM: 4GB
IDE: Ms Visual Studio 2010
It will be helpful if you address these issues ASAP as we have product release soon.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Urngent:Memory issue while surface graph plot

Post by Narcís » Tue Jan 13, 2015 9:44 am

Hello Alias,

1. Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

2. Can you please provide a simple running example for that as well?

3. No specific 3D "fast" series. However, you can apply some of the suggestions in the Real-time Charting article here so that your chart refreshes as fast as possible.

Also, which exact version of TeeChart are you using?

Thanks in advance.
Best Regards,
Narcís Calvet / 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

Alias
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2014 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Alias » Tue Jan 13, 2015 12:30 pm

Narcís wrote:Hello Alias,

1. Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

2. Can you please provide a simple running example for that as well?

3. No specific 3D "fast" series. However, you can apply some of the suggestions in the Real-time Charting article here so that your chart refreshes as fast as possible.

Also, which exact version of TeeChart are you using?

Thanks in advance.
Hi Narcís,
I will share sample example soon.
For now, I have attached error screen shot with all error details. Please have a look.
Attachments
TChartMemoryException.jpeg
T Chart Error Info
TChartMemoryException.jpeg (103.43 KiB) Viewed 25040 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Urngent:Memory issue while surface graph plot

Post by Narcís » Tue Jan 13, 2015 12:41 pm

Hi Alias,

Thanks for the feedback. With this error message is almost impossible finding which the problem might be. According to the image I guess you are using setting the IrregularGrid property of your 3D series to true. My suggestion would be to try disabling it unless it's strictly necessary. Charts with IrregularGrid set to true are slower to calculate and therefore slower to plot.
Best Regards,
Narcís Calvet / 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

Alias
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2014 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Alias » Wed Jan 14, 2015 3:03 pm

Narcís wrote:Hi Alias,

Thanks for the feedback. With this error message is almost impossible finding which the problem might be. According to the image I guess you are using setting the IrregularGrid property of your 3D series to true. My suggestion would be to try disabling it unless it's strictly necessary. Charts with IrregularGrid set to true are slower to calculate and therefore slower to plot.
Hi Narcis,
Thanks for info. In my case IrregularGrid = true;
Initially with this property memory exception occured while processing/plotting 19 file but if I set to false it works for more than 40 files. But If I load more than 100 files same exception.
Sample code what i m doing

Code: Select all

void AddSuface(DataTable dataSourceTable, string xColName, string yColName, string zColName)
{
Surface surface = new Surface();
            surface.IrregularGrid = true;
            //Add data to the surface object
            for (int Index = 0; Index < dataSourceTable.Rows.Count; Index++)
            {
                DataRow xrow = dataSourceTable.Rows[Index];
                double xVal = Convert.ToDouble(xrow[xColName]);
                for (int Index1 = 0; Index1 < dataSourceTable.Rows.Count; Index1++)
                {
                    DataRow row = dataSourceTable.Rows[Index1];
                    double zVal = Convert.ToDouble(row[zColName]);
                    double yVal = Convert.ToDouble(row[yColName]);
                    surface.Add(xVal, yVal, zVal);
                }
            }

            //surface.CheckDataSource();
            surface.UseColorRange = false;
            surface.UsePalette = true;
            surface.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Rainbow;
            surface.PaletteSteps = 10;
            surface.Title = lineTitleName;
            //surface.Color = lineColor;
            this.Legend.CheckBoxes = true;
            this.Legend.Visible = false;
            this.Series.Add(surface);
 if (lastAxis != null)
            {
                lastAxis.Visible = true;
            }

            if (this.Series != null)
            {
                this.Series[this.Series.Count - 1].GetHorizAxis.Title.Caption = horAxisTitle;
                this.Series[this.Series.Count - 1].GetHorizAxis.Automatic = true;
                this.Series[this.Series.Count - 1].GetHorizAxis.Visible = true;

                ////this.Series[this.Series.Count - 1].GetVertAxis.Automatic = false;
                this.Series[this.Series.Count - 1].GetVertAxis.Title.Caption = vertAxisTitle;
                this.Series[this.Series.Count - 1].GetVertAxis.Title.Visible = true;

                if (labelSelect == true)
                {
                    this.Series[this.Series.Count - 1].Active = true;
                }
                else
                {
                    this.Series[this.Series.Count - 1].Active = false;
                }
                this.Series[this.Series.Count - 1].GetSeriesMark -= new Series.GetSeriesMarkEventHandler(point_GetSeriesMark);
                this.Series[this.Series.Count - 1].GetSeriesMark += new Series.GetSeriesMarkEventHandler(point_GetSeriesMark);
                this.Series[this.Series.Count - 1].ValueFormat = "#,##0.000,000,000,###";
                this.Axes.Bottom.Labels.ValueFormat = "#,##0.000,###";
                this.Axes.Left.Labels.ValueFormat = "#,##0.000,###";
            }
}

 void point_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
        {
            string SeriesValue = string.Empty;
            if (!string.IsNullOrEmpty(e.MarkText))
            {
                SeriesValue = series.Title + " = "+ e.MarkText;
                e.MarkText = SeriesValue;
            }
            else
            {
                e.MarkText = series.Title;
            }
        }
To reproduce you can iterate for more than 40 data tables. average row count =>1200, Column count => 3, in each table. data type double.
Teechart Product version - 4.1.2014.8122

Code: Select all

//Pass loaded data table list as mentioned in previous post
foreach(int index =0;index<DateSet.count,index++)
{
  Func(table[index],table[index].col1,table[index].col2,table[index]col3);
}
If you still need sample example I will create soon. But please send me link of your sample example for surface graph as above.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Christopher » Thu Jan 15, 2015 11:04 am

Alias wrote:If you still need sample example I will create soon. But please send me link of your sample example for surface graph as above.
The attached file here:
SurfaceTest_Form.zip
(3.56 KiB) Downloaded 1379 times
contains a Windows Form which here runs without throwing an exception. Does it run without generating an exception at your end? If it does, can you please modify it so I can reproduce your issue here?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Alias
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2014 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Alias » Fri Jan 16, 2015 11:31 am

Christopher wrote:
Alias wrote:If you still need sample example I will create soon. But please send me link of your sample example for surface graph as above.
The attached file here:
The attachment SurfaceTest_Form.zip is no longer available
contains a Windows Form which here runs without throwing an exception. Does it run without generating an exception at your end? If it does, can you please modify it so I can reproduce your issue here?
Hi Chirstopher,
Thanks for your sample. I have modified and attached (Form1.zip)the same, now it generates the memory exception. It contains Form1. Plz add to your project. When you run the application you will get Form with button 1 and tchart panel. Click on button1 and wait for some time till exception is generated. Please revert if you want more info regarding exception.
Thanks.
Attachments
Form1.zip
Sample example with memory exception
(3.99 KiB) Downloaded 1340 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Christopher » Mon Jan 19, 2015 9:45 am

Hello,

This error occurs on the first Surface series created, that is, it is reproducible with this change:

Code: Select all

            //for (int i = 0; i < 60; i++)
            //{
            AddSuface(CreateDataTable(x, y, z), x, y, z);
            //}
In the source code, the exception is thrown here:
outofmem.png
outofmem.png (32.72 KiB) Viewed 24957 times
This error is most likely due to the fact that, by default, "Arrays greater than 2 GB in total size are not enabled" as is specified here.

Here, setting <gcAllowVeryLargeObjects> to true inhibits the throwing of this error.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Alias
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2014 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Alias » Tue Jan 20, 2015 5:08 am

Christopher wrote:Hello,

This error occurs on the first Surface series created, that is, it is reproducible with this change:

Code: Select all

            //for (int i = 0; i < 60; i++)
            //{
            AddSuface(CreateDataTable(x, y, z), x, y, z);
            //}
In the source code, the exception is thrown here:
outofmem.png
This error is most likely due to the fact that, by default, "Arrays greater than 2 GB in total size are not enabled" as is specified here.

Here, setting <gcAllowVeryLargeObjects> to true inhibits the throwing of this error.
Hi Christopher,
I tried below change in the sample application. But the error is still reproducible. Please try at your side with the sample application provided.
<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Urngent:Memory issue while surface graph plot

Post by Christopher » Tue Jan 20, 2015 8:48 am

Alias wrote: I tried below change in the sample application. But the error is still reproducible. Please try at your side with the sample application provided.
<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>
As I said, I can't reproduce the error on this machine with gcAllowVeryLargeObjects set to true.

More generally, this issue is unavoidable, in a sense. There will always be a time when adding a sufficient number of elements into an array will cause an "out of memory exception". Given that a (1000, 1000) surface series is of too high a pixel resolution to be painted on a screen the size of a computer screen, reducing it to (100, 100) will have no impact on its visual rendering.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply