Page 1 of 1

Impoting a Text File for Tower series.

Posted: Fri Oct 21, 2005 8:32 am
by 8125470
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

Posted: Fri Oct 21, 2005 9:04 am
by 8125470
I have reverted back to the latest of version 1 and it si the same. :(

Posted: Fri Oct 21, 2005 9:55 am
by narcis
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.

Posted: Fri Oct 21, 2005 10:06 am
by 8125470
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 :(

Posted: Mon Oct 24, 2005 10:41 am
by narcis
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.

Posted: Mon Oct 24, 2005 1:17 pm
by narcis
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.

Posted: Mon Oct 24, 2005 1:38 pm
by 8125470
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

Posted: Mon Oct 24, 2005 1:53 pm
by narcis
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.

Posted: Tue Oct 25, 2005 8:32 am
by 8125470
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)

Posted: Tue Oct 25, 2005 8:44 am
by narcis
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.

Posted: Tue Oct 25, 2005 8:57 am
by 8125470
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.

Posted: Tue Oct 25, 2005 11:00 am
by narcis
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.