Pie Chart and List of Object Lists

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Pie Chart and List of Object Lists

Post by Alexandre » Thu May 26, 2011 3:06 pm

Hi,

I have a little problem of understanding with the Pie Chart. I'll try to describe my problem with an example :
1°) I have one product which contains several properties which have a particular value in a specific date
2°) My ProductValueDateList contains one product's values for several date
3°) My ProductList contains several ProductValueDateList , as many as product I have.

I want my Pie Chart display the value for each product in the same date (for compare them). How can I do this ?
If you do not understand what I mean, I can draw something much easier to understand (sometime, draw is a better language than write).

This is a little complex, that's why I require your help.

Thank you =)

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

Re: Pie Chart and List of Object Lists

Post by Sandra » Fri May 27, 2011 1:40 pm

Hello Alexandre,

I think that you can achieve following doing next:

1.- Select of your productList one ProductValueDateList.
2.- Add ProducteValueDateList to Pie, that you find value as you want doing a query to date.
3.- Add value are you find in Pie and you can use name of product as label.

I hope will help.

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

Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Re: Pie Chart and List of Object Lists

Post by Alexandre » Mon May 30, 2011 9:41 am

Hi Sandra,

Thank you for the answer.
I tried to follow your advices but nothing is displaying in the chart.

Here's the code I used :

Code: Select all

foreach (List<AUM> item in aListOfAumLists)
{
         pie.Add(from aum in item where aum.Date == aDate select aum.AUMPart);
}
Is there a problem with it or am I misunderstanding you ?
I don't need the ProducteValueDateList in the chart, just the value (here's AUMPart) for one specific Date.

Thanks.

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

Re: Pie Chart and List of Object Lists

Post by Sandra » Mon May 30, 2011 11:34 am

Hello Alexandre,

Ok. Can you send us, a simple project so we can reproduce exactly your problem and we can try to detected where is it occurs?

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

Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Re: Pie Chart and List of Object Lists

Post by Alexandre » Mon May 30, 2011 1:23 pm

Hi Sandra,

Here's the simple project I created for you. It's a little simplistic but it's more or less what I've done in my real project.

Thank you.
Attachments
PieChart.zip
(31.46 KiB) Downloaded 255 times

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

Re: Pie Chart and List of Object Lists

Post by Sandra » Tue May 31, 2011 11:20 am

Hello Alexandre,

Seems that your problem is when you do the select. I have solved it changing next code:

Code: Select all

    foreach (List<Product> item in aListOfProductLists)
                    {
                        IEnumerable<double> result = from product in item where product.Date == aDate select product.Price;
                        
                        pie.Add(from product in item where product.Date == aDate select product.Price);
                    }
To the below lines of code:

Code: Select all

foreach (List<Product> item in aListOfProductLists)
                    {
                        IEnumerable<double> result = from product in item where product.Date == aDate select product.Price;

                        foreach (var item1 in result.ToList())
                        {
                            pie.Add(item1);
                        }
                    }
Please, do my recommendation changes in your application and tell us if these solve your problem.

I hope will helps.

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

Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Re: Pie Chart and List of Object Lists

Post by Alexandre » Tue May 31, 2011 12:32 pm

Hi Sandra,

Your recommendation was very helpful and solved my problem.
Thank you very much =)

Best regards.

Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Re: Pie Chart and List of Object Lists

Post by Alexandre » Tue May 31, 2011 1:38 pm

Just one more little question.
How can I add the ID corresponding to my Product in the Chart Legend ?

Thank you.

Alexandre
Newbie
Newbie
Posts: 6
Joined: Tue Aug 03, 2010 12:00 am

Re: Pie Chart and List of Object Lists

Post by Alexandre » Tue May 31, 2011 2:10 pm

Sorry for the triple post (no edit function ?), but I found the solution :

var result = from aum in aumList where aum.Date == aDate select new { aum.AUMPart, aum.CodeShare };
foreach (var item in result.ToList())
{
pie.Add(item.AUMPart, item.CodeShare);
}

Thanks =)

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

Re: Pie Chart and List of Object Lists

Post by Sandra » Tue May 31, 2011 4:12 pm

Hello Alexandre,

Don't worry. I am glad that you find a solution for your problem :)

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