TCHART .NET V2 seems to have a problem when saving a template.
I create a chart which has series with a datatable as the datasource, I save the template into my database.
See the DataMember field from the YValues property of my series before I save the template.
- YValues {Steema.TeeChart.Styles.ValueList} Steema.TeeChart.Styles.ValueList
Capacity 0 Integer
Chart Nothing Steema.TeeChart.Chart
Container Nothing System.ComponentModel.IContainer
Count 0 Integer
DataMember "ALLOC" String
DateTime False Boolean
DefaultCapacity 0 Integer
First 0.0 Double
Item <cannot view indexed property> Double
Last <error: an exception of type: {System.IndexOutOfRangeException} occurred> Double
When I want to see the chart again, I read the template from my database , now see the DataMember from the YValues property
- YValues {Steema.TeeChart.Styles.ValueList} Steema.TeeChart.Styles.ValueList
Capacity 0 Integer
Chart Nothing Steema.TeeChart.Chart
Container Nothing System.ComponentModel.IContainer
Count 600 Integer
DataMember "Y" String
DateTime False Boolean
DefaultCapacity 0 Integer
First 463.45 Double
Item <cannot view indexed property> Double
Last 492.09454 Double
There is something overwriting DataMember for both XValues and Yvalues.
This has only started with V2. The ability to record datasource information accurately in the template is vital to my application. A quick response to this query would be very much appreciated, as I will have to revert back to V1 if this can't be resolved.
datamember field being overwriten when saving a template
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi ...
The following code:
Works in the same way here in both TeeChart for .NET v1.1.1879.21176 and TeeChart for .NET v2.0.1992.14012. Could you please confirm this for me? If you are still experiencing problems, could you please sent me a code snippet with which I can reproduce the problem here?
Many thanks.
The following code:
Code: Select all
private DataTable CreateDataSet()
{
DataTable Employee = new DataTable();
DataColumn SALARY = new DataColumn("SALARY", Type.GetType("System.Int32"));
DataColumn ID = new DataColumn("ID", Type.GetType("System.Int32"));
DataColumn LASTNAME = new DataColumn("LASTNAME", Type.GetType("System.String"));
Employee.Columns.Add(SALARY);
Employee.Columns.Add(ID);
Employee.Columns.Add(LASTNAME);
DataRow dataRow;
dataRow = Employee.NewRow();
dataRow[SALARY] = 10000;
dataRow[ID] = 1;
dataRow[LASTNAME] = "Jones";
Employee.Rows.Add(dataRow);
return Employee;
}
private void Form1_Load(object sender, System.EventArgs e)
{
bar1.Clear();
bar1.DataSource = CreateDataSet();
bar1.YValues.DataMember = "SALARY";
bar1.XValues.DataMember = "ID";
bar1.LabelMember = "LASTNAME";
bar1.CheckDataSource();
}
private MemoryStream stream;
private Point location;
private Size size;
private void button1_Click(object sender, System.EventArgs e)
{
stream = new MemoryStream();
tChart1.Export.Template.Save(stream);
location = tChart1.Location;
size = tChart1.Size;
}
private void button2_Click(object sender, System.EventArgs e)
{
tChart1.Dispose();
tChart1 = new Steema.TeeChart.TChart();
tChart1.Header.Lines = new string[] {"TeeChart"};
tChart1.Location = location;
tChart1.Size = size;
this.Controls.Add(tChart1);
}
private void button3_Click(object sender, System.EventArgs e)
{
stream.Position = 0;
tChart1.Import.Template.Load(stream);
MessageBox.Show(tChart1[0].YValues.DataMember);
}
Many thanks.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi
Further to this: a defect has been found in this area which can be seen by running the the code I sent in my previous message but adding a name to the DataTable, i.e.
DataTable Employee = new DataTable("Employee");
instead of:
DataTable Employee = new DataTable();
In this case, as you suggest, the DataMember name is overwritten. This defect has already been fixed and this fix will be included into the next release of TeeChart for .NET version 2 which will be released shortly.
In the meantime you should be able to workaround this problem by making sure the TableName property of your DataTables is set to an empty string.
Further to this: a defect has been found in this area which can be seen by running the the code I sent in my previous message but adding a name to the DataTable, i.e.
DataTable Employee = new DataTable("Employee");
instead of:
DataTable Employee = new DataTable();
In this case, as you suggest, the DataMember name is overwritten. This defect has already been fixed and this fix will be included into the next release of TeeChart for .NET version 2 which will be released shortly.
In the meantime you should be able to workaround this problem by making sure the TableName property of your DataTables is set to an empty string.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
I still think there are problems with the DATAMEMBER being overwritten.
I'm using build 2.0.2207.17143 under VS 2003.
I create a series with YVALUES.DATAMEMBER set to "PCTCPUBY" XVALUES.DATAMEMBER set to "" (i.e. not set at all) and LABELMEMBER set to "DATE". all of which are columns in my data table.
I save the TEN file to the database, immediately before the save I check these properties and all are set appropriately.
I then read the ten file from the database and import it to a chart. I then check each of these properties again and find that the XVALUES.DATAMEMBER is now set to "X".
If I create a series with XVALUES and YVALUES and no LABELMEMBER, after the read the LABELMEMBER is set to "Labels". There appears to be some initialisation within the TCHART component that shouldn't be happening.
Any ideas?
I'm using build 2.0.2207.17143 under VS 2003.
I create a series with YVALUES.DATAMEMBER set to "PCTCPUBY" XVALUES.DATAMEMBER set to "" (i.e. not set at all) and LABELMEMBER set to "DATE". all of which are columns in my data table.
I save the TEN file to the database, immediately before the save I check these properties and all are set appropriately.
I then read the ten file from the database and import it to a chart. I then check each of these properties again and find that the XVALUES.DATAMEMBER is now set to "X".
If I create a series with XVALUES and YVALUES and no LABELMEMBER, after the read the LABELMEMBER is set to "Labels". There appears to be some initialisation within the TCHART component that shouldn't be happening.
Any ideas?
An update, On further investigation I found that I was setting the name of my source datatable, once this name was removed all seems to be well.
However the underlying defect still seems to be there, i.e. if a datasource is a datatable, and that datatable has a name then the various datamember fields are overwritten.
Thanks..
However the underlying defect still seems to be there, i.e. if a datasource is a datatable, and that datatable has a name then the various datamember fields are overwritten.
Thanks..
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Adrian,
I've been able to reproduce what you report. This seems to have been "broken" again. I've added the defect to our bug list to be fixed for future releases.
I've been able to reproduce what you report. This seems to have been "broken" again. I've added the defect to our bug 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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello Adrian,
This problem is slightly different to the overwriting of DataMember strings although the symptoms are very similar.
In any case I've fixed this issue and this fix will be available in the next Debug build which I hope to be able to release at the end of the week.
This problem is slightly different to the overwriting of DataMember strings although the symptoms are very similar.
In any case I've fixed this issue and this fix will be available in the next Debug build which I hope to be able to release at the end of the week.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/