Page 1 of 1

Does Teechart support datasource as Generic List<T>?

Posted: Wed Mar 11, 2009 8:26 am
by 13052670
I use LinQ2SQL to access database in my project, and most of query results is IQueryable<> or List<>. But it seems Teechart cannot work with such datasource. I don't want to convert my List<> source to DataTable, that takes a horribly long time. Another way, writing an ADO link to get DataTable specially for Teechart is also very fool, I already have my own data-access methods.

Can't I set an IList as datasource and specify a property of the elementtype as labelmember and another as datamember? It's very easy for all official .NET controls which uses datasource. For example:

Code: Select all

public class Person
{
  public string Name {get;set;}
  public int Age {get;set;}
}

List<Person> crowd = new List<Person>
{
  new Person { Name = "Tom", Age = 20 },
  new Person { Name = "Jack", Age = 27 },
  new Person { Name = "Andy", Age = 22 }
};


DropDownList1.DataSource = crowd;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "Age";
DropDownList1.DataBind();

DataList1.DataSource = crowd;
DataList1.DataBind();
GridView1.DataSource = crowd;
GridView1.DataBind();
.....
All of above can work, but when I try to do it to a WebChart:

Code: Select all

Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(WebChart1.Chart);
pie1.DataSource = crowd;
pie1.LabelMember = "Name";
pie1.YValues.DataMember = "Age";
even cannot pass the compilation.

System.Collections.IList and System.Collections.Generic.List<T> are common datasources, but TeeChart doesn't support them?

So I would like to know what I'm supposed to do if I need the chart shows properly.

Thank you!

Posted: Wed Mar 11, 2009 11:35 am
by narcis
Hi Li,

Currently TeeChart supports List but not List<T>. I have added your request to the wish-list to be considered for inclusion in future releases. In the meantime you can populate series like this:

Code: Select all

			for (int t = 0; t < crowd.Count; t++)
				pie1.Add(crowd[t].Age, crowd[t].Name);

Posted: Thu Mar 12, 2009 1:15 am
by 13052670
I see.. thanks for your solution, it works. Great!

Wish users can set Series.DataSource = (IList) or (List<T>) and set DataMember as a propertyname directly in a future version of TeeChart as my suggestion. It will make much better coding-experiences than write a cycle myself.

However, I can use it by your way now, that's also good! I'm happy to see TeeChart is a very customizable tool.

Thank you Narcís!

Re: Does Teechart support datasource as Generic List<T>?

Posted: Fri Nov 09, 2012 8:39 am
by 15661911
How now about use List<T> as serie.DataSource ?

Re: Does Teechart support datasource as Generic List<T>?

Posted: Fri Nov 09, 2012 11:58 am
by 10050769
Hello Nik,

I am afraid this feature hasn't been implemented yet. I increased the severity of the issue [TF02013957] and we will try to include it for upcoming versions of TeeChart For .Net. On the other hand, the request hasn't been implemented yet because fixed/implemented issues depend on variables such as the complexity of the problem, the number of issues with even higher priority that claims our team attention, etc.


Thanks,

Re: Does Teechart support datasource as Generic List<T>?

Posted: Mon Dec 03, 2012 6:13 pm
by 15663422
Hi,

is that really no Joke ??? You can not even bind your DataSource to the Standard IEnumerable<> or IList<> ??? Puuuuhh. We buyed TeeChart.net because it seemed like a nitty gritty future-oriented good-working and easy-living Chart Component. But that is an absolutly K.O-Criteria. I can´t believe first, so i looked into the Documentation and found that:

Any TChart Series can be optionally connected to a "point provider" (or DataSource). The "point provider" (or DataSource) can be:
1) Another Chart Series.
2) Any data recordset such as Dataset or SQLDataAdapter
3) XML and Text datasources

Either a .net DataSet can their self binded to a List<> nor XMLDocument can. So no workaround possible.

Really sad :( It seems to me (XmlDocument used for Steemas XmlSource, not the newer XDocument Linq Type, e.g., but other places shows this too) like Steemas .Net Component is rather old and developed in .net 2.0 and not really changed since then.

I´m not impressed now and feel sad, because in Possibilities and Quality Steema seems good since Years :( What a pity.

But, No harm meant! We just have to use the Add() Methods and have no DataBinding to Models.

Best Regards,
Marcel

Re: Does Teechart support datasource as Generic List<T>?

Posted: Tue Dec 04, 2012 10:04 am
by 10050769
Hello Marcel,

I confirm you, the feature request number [TF02013957] that refers to use Generic List <T> directly, will be implemented for next maintenance release of TeeChartFor.Net.I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.

Thanks,