Impoting a Text File for Tower series.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Impoting a Text File for Tower series.

Post by VH1 » Fri Oct 21, 2005 8:32 am

2.0.2040.15118

Hi,

I have created a tower series, filled it with 50 sample values and exported it to Chart1.txt file from the Editor.

I then deleted the series and added a new tower series and set the datasource to a text file, (the one I just created).

I then hit Apply and it gives me the following:

An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll

Additional information: Index was out of range. Must be non-negative and less than the size of the collection.

Am I missing something here, please can you give me an example of how I can import a text file?

Many thanks,

Vaughan

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Fri Oct 21, 2005 9:04 am

I have reverted back to the latest of version 1 and it si the same. :(

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

Post by Narcís » Fri Oct 21, 2005 9:55 am

Hi Vaughan,

To import series data from a .txt file please have a look at the "All Features\Welcome !\Importing\Data\From text file" example at TeeChart features demo available at TeeChart's program group.

For the importing data that way it would may be more suitable for you to use an XML file. You'll find example on the features demo an tutorials.
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Fri Oct 21, 2005 10:06 am

If I was to allow the user to use the Editor to export and then import a text file, regardless of if the file was valid or not, I would not want this exception to kill my application :(

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

Post by Narcís » Mon Oct 24, 2005 10:41 am

Hi Vaughan,

I've been able to reproduce the problem here and we've found there's a bug that when importing series data from a text file X,Y and Z values are not supported, just X and Y values are supported. I've added this (TF02011037) to our defect list to be fixed for future releases.
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

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

Post by Narcís » Mon Oct 24, 2005 1:17 pm

Hi Vaughan,

After further testing we have found that this is not a bug, it works fine using the code below:

Code: Select all

		private void button1_Click(object sender, System.EventArgs e)
		{
			/* v2 *///Steema.TeeChart.Data.TextSource ts = new Steema.TeeChart.Data.TextSource("../../RXQULvsMSP.csv");
			/* v1 */Steema.TeeChart.Data.TextSource ts = new Steema.TeeChart.Data.TextSource();
			if(System.IO.File.Exists("../../RXQULvsMSP.csv"))
			{
				System.IO.File.Copy("../../RXQULvsMSP.csv", @"C:\temp\testnet2.txt", true);
				tower1.Clear();
				tower1.IrregularGrid=true;
				textSource1.HeaderLines = 1;
				textSource1.Separator = ',';
				textSource1.Series = tower1; 
				textSource1.Fields.Add(1, "X");
				textSource1.Fields.Add(2, "Y");
				textSource1.Fields.Add(3, "Z");
				/* v2 *///textSource1.LoadFromFile(@"C:\temp\testnet2.txt");

				/* v1 */textSource1.FileName = @"C:\temp\testnet2.txt";
				/* v1 */textSource1.RefreshData();
			}
		}
Notice the differences for v1 and v2.
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Mon Oct 24, 2005 1:38 pm

Thanks Narcis,

I will try this, however, even if I implement this for myself the Editor will still fail?

Will you still be fixing this in future releases (TF02011037)

Many thanks,

Vaughan

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

Post by Narcís » Mon Oct 24, 2005 1:53 pm

Hi Vaughan,

No, using the editor works too. You may not be using it properly, could you should:

1) Set the fields to its column index starting at 0.
2) Not using any "Text" field.
3) Setting the number of header lines.
4) Setting the separator.
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Tue Oct 25, 2005 8:32 am

I have tried the Editor and I have eventually got it to work for the file you specified. Still after many exceptions and application crashes...

...even if the end user enters the fields incorrectly int he Editor I still would not expect the application to crash! :(

However, using this same method it still does not accept the other file I sent to you MSPvsRXQUL.

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Tower.DrawCell(Int32 x, Int32 z)
at Steema.TeeChart.Styles.Tower.DrawCells()
at Steema.TeeChart.Styles.Tower.Draw()
at Steema.TeeChart.Styles.Series.DrawSeries()
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)

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

Post by Narcís » Tue Oct 25, 2005 8:44 am

Hi Vaughan,

I've just sent to your e-mail address account the project I've used to load your files and which works here.
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Tue Oct 25, 2005 8:57 am

I have just tried the sample project you sent to me.

Indeed for the first time, it does load in this file :)

However, if you attempt to change the series to a surface and then back to tower it still gives the same error.

I have also noticed in your project that you set the following:

tower1.IrregularGrid=true;

Without this line, Teechart fails to load the file.

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

Post by Narcís » Tue Oct 25, 2005 11:00 am

Hi Vaughan,

Yes, this leads to the issue you reported in this thread, where I've posted a workaround.
I have also noticed in your project that you set the following:

tower1.IrregularGrid=true;

Without this line, Teechart fails to load the file.
Yes, this is important for those series types. IrregularGrid determines if X and Z values are equi-distant or not.
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

Post Reply