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

pie chart in metro

3 Answers 185 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.
Suresh
Top achievements
Rank 1
Suresh asked on 26 Oct 2012, 10:35 AM
Hi
How to Hilite selected slice from pie chart. like bellow image, can you please help ,,,




Regards
Suresh

3 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 26 Oct 2012, 01:23 PM
Hi, Suresh

Thank you for using RadControls for Windows8!

In order to achieve this result you can use the ChartSelectionBehavior and set its DataPointSelectionMode="Single". In this case when you select a pie slice you will accomplish the described scenario. Here's the implementation: 

<telerik:RadPieChart.Behaviors>
    <telerik:ChartSelectionBehavior DataPointSelectionMode="Single"></telerik:ChartSelectionBehavior>
</telerik:RadPieChart.Behaviors>

Additionally, if you want to change the appearance of the selected slice you will need to specify the SelectionPalette property of RadPieChart or use the SelectionPaletteName to choose some of the built-in palettes.

I hope this information is useful. Let me know if I can assist you any further.

 

Greetings,
Ivaylo Gergov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Suresh
Top achievements
Rank 1
answered on 30 Oct 2012, 06:30 AM
Hi Ivaylo Gergov
Thanks for your help, its working , in the same way how to set default selection of slice and tooltip on slice mouse over. I didnt find the way to set default slice selection..

Thanks in advance for your great help.

Regards
Suresh

0
Ivaylo Gergov
Telerik team
answered on 31 Oct 2012, 11:42 AM
Hello, Suresh

Thank you for getting back to us.

In order to set tooltip on slice mouse over you can use the ChartTooltipBehavior and set its ContentTemplate. Here's an example:

<telerik:ChartTooltipBehavior>
     <telerik:ChartTooltipBehavior.ContentTemplate>
         <DataTemplate>
             <StackPanel>
                 <TextBlock Text="Tooltip" Foreground="Blue" ></TextBlock>
             </StackPanel>
         </DataTemplate>
     </telerik:ChartTooltipBehavior.ContentTemplate>
 </telerik:ChartTooltipBehavior>

About the default slice selection I suggest you to add IsSelected property to your ViewModel:
public bool IsSelected { get; set; }

Set it to True on the desired point:
data[0].IsSelected = true;

And bind the property to the PieSeries:
<telerik:PieSeries.IsSelectedBinding>
    <telerik:PropertyNameDataPointBinding PropertyName="IsSelected"/>
</telerik:PieSeries.IsSelectedBinding>


Another approach is to create an event which executes after the data is loaded and before it is visualized. Here's an example:

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    (this.chart.Series[0] as PieSeries).DataPoints[0].IsSelected = true;
}

and define it in the Main Page:

this.Loaded += MainPage_Loaded;

In this example the first DataPoint of the first PieSeries in your Chart will be with default property IsSelected = true.

I believe this helps. Let me know if I can assist you any further.

 

All the best,
Ivaylo Gergov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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