2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
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.
Note: This property works only when you enable the EnableDataPointSelection property in series.
The following code example shows the selection feature for series segment. XAML <chart:SfChart.Series> <chart:ColumnSeries ItemsSource="{Binding Data}" EnableDataPointSelection="True" SelectedDataPointColor="#B399E6" /> </chart:SfChart.Series> C# ColumnSeries series = new ColumnSeries() { EnableDataPointSelection = true, SelectedDataPointColor = Color.FromRgba(0.7, 0.6, 0.9, 1), ItemsSource = GetData() }; chart.Series.Add(series); Output:
|
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.
Hello how deactvate the color change for the selected bar in the BarSeries chart type?
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.
is there a way to get only one colour to selected bar on sf chart series when we have more columns
Hi Sivanarayanareddy,
You can achieve your requirement with the help of setting SelectedDataPointIndex as -1 for previous selected series in the SelectionChanged event as per the below code example.
CodeSnippet: [MainPage.xaml]
MainPage.xaml.cs
We have attached the sample for your reference. Please find the sample from the below link
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ChartSample657441440
Please let us know if you need any further assistance.
Regards, Yuvaraj.