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

RadPieChart ItemSelections

2 Answers 107 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Afife Betül
Top achievements
Rank 1
Afife Betül asked on 24 Jun 2013, 09:34 AM

Requirements

RadControls version
.NET version
Visual Studio 2012
WPF
browser support

all browsers supported by RadControls


Hello,

I need a PieChart and I am trying to use RadPieChart. But I want to select item that is slice of my PieChart. So, I can show my users that select to want item to change OffsetFromCenter Value.

Thank you for helping.

2 Answers, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 27 Jun 2013, 06:47 AM
Hello Afife Betül,

It is a bit hard for me to understand your exact inquiry, so I will offer you two options.

The first one, if you want to select one of the slices in runtime and it expands. You just need to add a selection behavior.
<telerik:RadPieChart x:Name="PieChart" Grid.Row="1">
            <telerik:PieSeries ValueBinding="Value" RadiusFactor="0.77">
            </telerik:PieSeries>
            <telerik:RadPieChart.Behaviors>
                <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_SelectionChanged"/>
            </telerik:RadPieChart.Behaviors>
</telerik:RadPieChart>

The other one, I am thinking of is you want to have one of the slices expanded from the start. You can check how to achieve that in this online demo with source code.

Regards,
Rosko
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
kavosh
Top achievements
Rank 1
answered on 14 Jul 2013, 06:41 AM
Hi Afife

What you actually need is to use the event Rosko mentioned, but you have to add below code to the event handler to do what you need.

private void ChartSelectionBehavior_SelectionChanged(object sender, ChartSelectionChangedEventArgs e)
        {
            var selectedPoints = e.AddedPoints;
            if (selectedPoints.Count > 0)
            {
                PieDataPoint point = (PieDataPoint) selectedPoints[0];
                point.OffsetFromCenter = 0.1;
            }
 
            var otherPoints = e.RemovedPoints;
            if (otherPoints.Count > 0)
            {
                foreach (PieDataPoint otherPoint in otherPoints)
                {
                    otherPoint.OffsetFromCenter = 0;
                }
            }
        }

Regards,
Kavosh
Tags
ChartView
Asked by
Afife Betül
Top achievements
Rank 1
Answers by
Rosko
Telerik team
kavosh
Top achievements
Rank 1
Share this question
or