We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the data point selection color?

Description:

ChartSelectionBehavior allows you to select any data point, that is, a segment in the series. This behavior highlights the particular segment inside the series. The selected segment color is not restricted to the default color.

Solution:

Essential chart for Xamarin.Forms provides data point selection and allows you to change the selected segment color for series. The SelectedDataPointColor property is used to define the custom color for the selected segment.

http://help.syncfusion.com/ug/wpf/ImagesExt/image249_147.pngNote: This property works only when you enable the EnableDataPointSelection property in series.

The following code example shows the selection feature for series segment.

XAML

C#

Output:

Macintosh HD:Users:syncfusionChart:Downloads:Merged.png

 

Article ID: Published Date: Last Revised Date: Platform: Control:
4957 05/23/2015 03/05/2018 Xamarin.Forms SfChart
Did you find this information helpful?
Comments
John Rennemeyer Dec 07, 2015
Is there a way to disable the selection color? In our case, we are using a PieSeries which explodes the selected item when tapped. We want the explode to occur, but not the color change. When we do not specify a SelectedDataPointColor, it defaults to some grayish color.
Reply
Karthikeyan V [Syncfusion] Dec 08, 2015
Hi John, We have analyzed your requirement. You can achieve your requirement with help of SelectionChanging event in chart. Please refer the below code example. Code Example: Chart.SelectionChanging += (object sender, ChartSelectionChangingEventArgs e) => { e.Cancel = true;// To avoid the selection color (e.SelectedSeries as PieSeries).ExplodeIndex = e.SelectedDataPointIndex; }; Regards, Karthikeyan V.
Gabriele Sep 14, 2017

Hello how deactvate the color change for the selected bar in the BarSeries chart type?

Reply
Muneesh Kumar G [Syncfusion] Sep 15, 2017

Hi Garbiele,

 

We are able to achieve your requirement to deactivate the color change for the selected bar by using below solutions.

 

Soloution 1 :

 

By tap the selected bar again.

 

Solution 2 :

 

Set the SelectedDataPointIndex = -1 via programmatically as per the below code snippet.

 

Code Snippet[C#]

 

series.SelectedDataPointIndex = -1;

 

Thanks,

Muneesh Kumar G.

Reply
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon