Manually Populate Pie Chart

Hi,

How can I manually populate the Pie chart without binding? for example, if I have the following:


Delivered   :  100
Pending.    :   40
Failed.        :   7




1 Reply 1 reply marked as answer

GM Gayathri Manickam Syncfusion Team December 6, 2021 04:21 PM UTC

Hi Jassim, 
 
Greetings from Syncfusion. 
 
We analyzed your query, and you can manually populate the pie chart without binding by adding code in the code behind and directly set the list to the ItemSource property as shown in the below code snippet. Please see below UG link and sample for your reference. 
 
SfChart chart = new SfChart(); 
             
PieSeries pieSeries = new PieSeries() 
 { 
       ItemsSource = new ViewModel().Data, 
       XBindingPath = "Name", 
       YBindingPath = "Height" 
  }; 
pieSeries.DataMarker = new ChartDataMarker(); 
pieSeries.DataMarker.ShowLabel = true
chart.Series.Add(pieSeries); 
this.Content = chart; 
 
 
 
Please revert us if misunderstood your requirement. 
 
Thanks,  
Gayathri M. 


Marked as answer
Loader.
Up arrow icon