This is a migrated thread and some comments may be shown as answers.

Custom Ordering of Pie Slices

1 Answer 44 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Colter
Top achievements
Rank 1
Colter asked on 27 May 2013, 06:40 PM
Hello Telerik,

Is it possible to define the order that the Pie Slices in a RadPieChart will be drawn?  I've tried to order the set of data that I'm giving the chart series but to no avail.  

var series = (RadChart as RadPieChart).Series.First();
var orderedSet = DataSet.OrderBy(d => d.Series);
series.ItemsSource = orderedSet;


It looks like it is drawing the slices based on largest to smallest... which makes sense.  But what I'm trying to do is keep the individual slices (as I have attached other data of interest to each one) but get them grouped together when the pie chart draws them.  In the example image, each slice is a male and female population for a particular neighborhood respectively.  I want to be able to map from a pie slice to a neighborhood and vice versa.  Is there any way that this can be done?

Regards,
Colter

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 30 May 2013, 08:19 PM
Hi Colter,

RadPieChart draws its slices in the same order as the corresponding data items appear in the ItemsSource. If you bind a ListBox to the same data, it should be ordered the same way. You can influence that order by reverting the pie direction. This is done by setting the PieSeries.AngleRange.SweepDirection property to Counterclockwise. If you want to order pie slices in a specific way, you just need to arrange the data items in the ItemsSource the same way.

Given that you want to display male/female ratios for different neighborhoods, you may also consider using a different visualization, such as horizontal a Stacked100 Bar Chart. (See attached screenshot and sample project).

I hope this helps.
 
Regards,
Petar Kirov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
Colter
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or