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

[Solved] Pie Chart Selection Change event

1 Answer 166 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jaren
Top achievements
Rank 1
Jaren asked on 12 Jun 2014, 07:02 PM
In the Demos-Telerik UI for Windows 8.1 XAML Q1 2014 Solution under the pie series there are three charts. My question revolves around the one where the chart explodes based on selecting a piece of the pie.

I am currently using another charting ui that allows me to change data based on the a selection of a piece of the pie for other charts I have on the page. Like selecting piece 1 of the pie builds charts based on what piece 1 is.

I like the look of Telerik charts better than the ones I am using, but I want the user to be able to select a piece of the pie and view data based on that piece. 

Am I able to do this with Telerik Charts? Has anyone tried?

From looking over the demo I think it is possible, but I can't seem to locate in the pie piece selection how the selection change is handled. Knowing how this is done would most likely give me a better idea if it can work unless someone already knows how.

Thanks

1 Answer, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 17 Jun 2014, 09:38 AM
Hi Jaren,

The described scenario can be achieved with the RadChart for Windows 8. First, you need to add the Selection Behavior and then handle its SelectionChanged event. Here's an example: 
<telerikChart:RadPieChart>
    <telerikChart:RadPieChart.Behaviors>
        <telerikChart:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_SelectionChanged" />
    </telerikChart:RadPieChart.Behaviors>
</telerikChart:RadPieChart>

In the help article you can see the properties that the ChartSelectionBehavior exposes. For example, you can get the business item that has been selected like this: 
private void ChartSelectionBehavior_SelectionChanged(object sender, EventArgs e)
{
    var selectedItem = (sender as ChartSelectionBehavior).SelectedPoints.FirstOrDefault().DataItem;    
}



Please, let me know should you have any other questions.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart for XAML
Asked by
Jaren
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Share this question
or