Hello
I am trying to bind data dynamicaly to pie cart but it is throwing error, I am binding it through WCF service.
I am doing like this...
public Page() { InitializeComponent();
svc.GetPieChartCompleted += new EventHandler<InfragisticChart.Dash.GetPieChartCompletedEventArgs>(svc_GetPieChartCompleted); svc.GetPieChartAsync(); }
void svc_GetPieChartCompleted(object sender, InfragisticChart.Dash.GetPieChartCompletedEventArgs e) { // System.Collections.ObjectModel.ObservableCollection<Dash.PieChart> List = e.Result;
/* This line is creating problem */
PieChart.Series[0].DataSource = e.Result;
PieChart.Series[0].DataMapping = "Value=Value;Label=Name";
PieChart.Series[0].DataBind(); }
please help me out....
Hi, can you provide a little more information? What is the error you are receiving? What are the properties on the objects in the collection that you are binding too? Do they have both a "Value" and and "Name" property? Have you added a series to the PieChart in the XAML? If you're getting a NullReference exception, my guess is there are no Series in the chart yet, you'd need to add one first, either in the XAML or in C# before you set the datasource on it.
thanx for your help...
series was not propely added previously...
now I am adding it in codebehind..
but now in pie chart that labels on chart not visible what is the property to visible them....
thanx in advance.....
Cool, glad that worked. For the values to appear in the chart, you need to add markers:
<igChart:Series.Marker> <igChart:Marker Foreground="#FFFFFFFF" MarkerSize="1" LabelDistance="5"/></igChart:Series.Marker>
http://help.infragistics.com/Help/NetAdvantage/DV/2009.1/CLR3.X/html/SL_DV_xamWebChart_Add_a_Marker.html
In your code for adding markers, is LabelDistance necessary? It does not seem to have any effect on the positioning of labels in pie charts. If it did, I would love to use it to position the labels outside the chart to avoid space issues.