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
Problems exporting XY chart data
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.
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.
Pep Jorge
http://support.steema.com
http://support.steema.com
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.
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.
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();
}
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.
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 :
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...
}
Pep Jorge
http://support.steema.com
http://support.steema.com
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.
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
http://www.steema.com