Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1655
How to Bind IList collection to 3d Pie Chart
posted

Hi,

I have an IList Collection. IList<Data>. Data have two propeties "Type" As String and "Count" As Integer.

I want to bind IList<Data> to 3D Pie Chart dynamically. Can you please help me how to achive this?

Thank You,

Regards

Ritesh

Parents
No Data
Reply
  • 9836
    Verified Answer
    posted

    Ritesh,

    The only thing you have to do in order to bind the Series to IList<Data> or any other collection implementing IEnumerable interface is to set the DataSource and the DataMapping. You can refer to our online documentation for more details :

    (http://help.infragistics.com/Help/NetAdvantage/WPF/2009.1/CLR3.X/html/xamChart_Binding_xamChart_to_a_Collection.html)

    void Window1_Loaded(object sender, RoutedEventArgs e)
            {
                IList<Data> list=new List<Data>();

                Data d1 = new Data() { Type = "T1", Count = 20 };
                Data d2 = new Data() { Type = "T2", Count = 30 };
                ...

                list.Add(d1);
                list.Add(d2);
                ...

                Series s = new Series();
                s.ChartType = ChartType.Pie;
                s.DataSource = list;
                s.DataMapping = "Value=Count;Label=Type";

                xamChart1.View3D = true;
                xamChart1.Series.Add(s);
            }

    Let me know if you have any questions with this matter.

    Regards

    Vlad

Children
No Data