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
20
How to bind dynamic data to a XAMPieChart?
posted

Hi,

Could you please let me know how can i bind dynamic data?

I mean, say I have a dictionary containing 10 values i.e Area<string,int> dictionary with 10 values.

How can I bind it to a pie chart (referring to the example given in the link: http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamPieChart_Data_Binding.html).

Thanks,

Manu

  • 34810
    Offline posted

    Hello Manu,

    I have been investigating into this behavior that you are looking to achieve, and it appears that you posted the same question at another forum thread that I had answered, here: https://ko.infragistics.com/community/forums/f/retired-products-and-controls/97678/bind-xampiechart-itemssource-to-viewmodel-property/523905#523905.

    The process is very much the same as in the documentation article that you sent as well as in the sample project that is attached to the other forum thread. When you bind a Dictionary to the XamPieChart.ItemsSource, the actual underlying data item is a KeyValuePair. As such, if you wanted the string keys to show up in the labels of the XamPieChart, you would set the LabelMemberPath to "Key," and if you wanted the int values of your dictionary to be used as the criteria for your slices, you would set the ValueMemberPath to "Value."

    For consistency, I am attaching the sample project mentioned on the other forum thread to this one. I hope it helps you.

    Please let me know if you have any other questions or concerns on this matter.

    XamPieChartBindingCase.zip

    Sincerely,
    Andrew
    Software Developer