Problems exporting XY chart data

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Michael
Newbie
Newbie
Posts: 6
Joined: Tue Jul 13, 2004 4:00 am
Location: South Africa

Problems exporting XY chart data

Post by Michael » Tue Aug 31, 2004 2:08 pm

Hi

I'm currently exporting data from a chart with several series on it (plotted using FastLine's) containing X-Y data, with a time-based x-axis.

When all the series contain one or more points, exporting works as expected, resulting in an Excel file with columns for the X and Y values for each series.

However, if one of the series then has no points added to it, then ONLY the Y-values are exported. Columns for the X (time) values are not even created. This problem applies to ALL the series, not just the one with no points.

What would be the best way to get around this problem for the time being? It certainly looks like a bug, because it seems to be inconsistent behaviour, but I may be missing something.

Thanks
~m

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Sep 01, 2004 8:34 am

Hi Michael,

adding the XValues as a Labels (i.e : line1.Add(10,DateTime.Today.ToString()); ) works fine here, using the latest version available on our web site.

Michael
Newbie
Newbie
Posts: 6
Joined: Tue Jul 13, 2004 4:00 am
Location: South Africa

Post by Michael » Thu Sep 02, 2004 1:33 pm

Hi Josep

I wrote a small sample program to test it, and it did seem to work initially, but I was eventually able to reproduce the problem. I've made sure we're using the same release of TeeCharts too.

Code: Select all

private void Form1_Load(object sender, System.EventArgs e)
		{
			DataSetData d1 = new DataSetData();
			DataTable t1 = d1.Tables.Add("Table");
			t1.Columns.Add("TimeStamp", typeof(double));
			t1.Columns.Add("Value", typeof(double));

			DataSetData d2 = (DataSetData)d1.Clone();
			DataSetData d3 = (DataSetData)d1.Clone();

			d1.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.ToOADate(), 10 });
			d1.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.AddHours(2).ToOADate(), 11 });
			d1.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.AddHours(3).ToOADate(), 15 });

			d2.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.ToOADate(), 13 });
			d2.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.AddHours(2).ToOADate(), 9 });
			d2.Tables["Table"].Rows.Add(new object[2] { DateTime.Today.AddHours(3).ToOADate(), 12 });
			
			
			// This way works (non-empty series added first)
			/*FastLine fl1 = new FastLine(tChart1.Chart);
			FastLine fl2 = new FastLine(tChart1.Chart);
			FastLine fl3 = new FastLine(tChart1.Chart); */

			// This way breaks the exporting functionality (empty series added first)
			FastLine fl3 = new FastLine(tChart1.Chart);
			FastLine fl1 = new FastLine(tChart1.Chart);
			FastLine fl2 = new FastLine(tChart1.Chart);
						
			fl1.XValues.DateTime = true;
			fl2.XValues.DateTime = true;
			fl3.XValues.DateTime = true;

			fl1.DataSource = d1.Tables["Table"];
			fl1.XValues.DataMember = "TimeStamp";
			fl1.YValues.DataMember = "Value";
			fl1.CheckDataSource();

			fl2.DataSource = d2.Tables["Table"];
			fl2.XValues.DataMember = "TimeStamp";
			fl2.YValues.DataMember = "Value";
			fl2.CheckDataSource();

			fl3.DataSource = d3.Tables["Table"];
			fl3.XValues.DataMember = "TimeStamp";
			fl3.YValues.DataMember = "Value";
			fl3.CheckDataSource();

		}
DataSetData is just a Dataset containing TimeStamp and Value columns, both doubles.

The interesting thing happens just below where the code is commented out.

If one adds the series such that the series with valid data are added first (commented-out code), everything is fine, and we get the following out:

<PRE>
X,Y,X,Y,X,Y
38232,10,38232,13,,
38232.08333,11,38232.08333,9,,
38232.125,15,38232.125,12,,
</PRE>

<P/>
But, if you add the empty series first (uncommented code), then something interesting happens:

<PRE>
Y,Y,Y
,10,13
,11,9
,15,12
</PRE>

It just drops all the x-columns from the spreadsheet altogether.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Sep 03, 2004 8:59 am

Hi Michael,

yes, you're correct. I'm able to reproduce the problem here. It seems to be a bug, I've added it on our defect list and a fix for it will be considered to inclusion for the next maintenance releases.
In meantime a workaround could be to check if there's a empty Series, and if so remove it, something like this :

Code: Select all

private void button1_Click(object sender, System.EventArgs e)
{
if (tChart1.Series[0].Count==0) tChart1.Series.Remove(tChart1.Series[0]);								
tChart1.ShowEditor();
// or export directly...
}

Michael
Newbie
Newbie
Posts: 6
Joined: Tue Jul 13, 2004 4:00 am
Location: South Africa

Post by Michael » Mon Sep 06, 2004 1:00 pm

Thanks Pep

I'll use the workaround in the meantime and keep an eye out for the fixed one.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Sep 15, 2004 11:46 am

Hi.

The problem you desribed will happen with all data export formats. I think we just fixed this bug - the fix will be included in next maintenance release.
Marjan Slatinek,
http://www.steema.com

Post Reply