Does Teechart support datasource as Generic List<T>?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Li Kunlun
Newbie
Newbie
Posts: 2
Joined: Fri Feb 27, 2009 12:00 am

Does Teechart support datasource as Generic List<T>?

Post by Li Kunlun » Wed Mar 11, 2009 8:26 am

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!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Mar 11, 2009 11:35 am

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);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Li Kunlun
Newbie
Newbie
Posts: 2
Joined: Fri Feb 27, 2009 12:00 am

Post by Li Kunlun » Thu Mar 12, 2009 1:15 am

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!

Nik
Newbie
Newbie
Posts: 9
Joined: Wed Mar 07, 2012 12:00 am

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

Post by Nik » Fri Nov 09, 2012 8:39 am

How now about use List<T> as serie.DataSource ?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

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

Post by Sandra » Fri Nov 09, 2012 11:58 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MarcelBeckSteca
Newbie
Newbie
Posts: 1
Joined: Wed Sep 05, 2012 12:00 am

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

Post by MarcelBeckSteca » Mon Dec 03, 2012 6:13 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

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

Post by Sandra » Tue Dec 04, 2012 10:04 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply