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

series bars how change color of label Text depending if SyncFusion is moving in or out the box bar

Thread ID:





132359 Aug 28,2017 02:32 PM UTC Nov 24,2017 05:16 AM UTC Xamarin.Forms 5
Tags: SfChart
Asked On August 28, 2017 02:34 PM UTC

Hello I have an issue.

I am doing a bars chart using code like below


<chart:ChartDataMarker LabelContent="Percentage" ShowLabel="True">





TextColor = "White"







Using the property LabelPosition="Auto" SyncFusion automatically will move the text of the BarLabel in or out the box.

I need to change the color of the text depending by if it is moved inside or outside the bar. How I can do it?

Could you please give to me a sample starting from XAML page, explaining how access/change the text label properties = TextColor based on where SyncFusion is moving the text (based on LabelPosition)?

Just an example to better explain:

if Value = 5% the text will be moved out and being the background color = white I need color to be black

if Value is 70% in this case text will be inside and color need to be white cause background color of the bar is blue.


Iyyappan Mani [Syncfusion]
Replied On August 29, 2017 03:23 PM UTC

Hi Garbiele,

Thanks for using Syncfusion Products.

As per your requirement, we have prepared a workaround sample using LabelTemplate Property in DataMarker. Please find the sample in below location.

Sample: http://www.syncfusion.com/downloads/support/forum/132359/ze/CustomLabel1990129899

Please let us know, if you need further assistance on this.

Iyyappan M.

Replied On August 30, 2017 10:20 AM UTC


thanks for your reply.

My need was more to recognize how the LabelPosition=Auto was locating the text of the label and depending if inside or outside changing the color of the text.

You gave an example based on the yvalue that is not exactly what I asked. Sure that could be a sort of workaround so if not other solutions are possible it is fine.

I have another question:

Always for the chart:BarSeries I need to have e legend that will be aligned on the right to the Bars of the chart. How can I achieve this goal?

I see that for this type of Chart is not possible to define a fix widht  of the bars so how would be possible to build a custom layout structure on the right of the chart to have aligned to the bar more complex elements (like buttons, link, image...)? This for more complex layout.



Parthiban Sundaram [Syncfusion]
Replied On August 30, 2017 12:41 PM UTC

Hi Gabriele,  
Thanks for the update. 
Query 1: 
We would like to inform you that our previous solution was the possible way to change individual data label background.  
Query 2: 
You can achieve this requirement using DockPosition in Legend. Please find the below code snippet for more details  
      <chart:ChartLegend DockPosition="Right"/> 
Query 3: 
We suspect that your requirement is related to customize the width of the bars which can be achieved using Width property in BarSeries. Please refer the following code snippet.  
<chart:BarSeries x:Name="series" ItemsSource ="{Binding Items}"  
                XBindingPath="XValue" YBindingPath="YValue" Label="ColumnSeries" Width ="0.5" />   
If your requirement is different from this.  Please provide more details to provide a proper solution.  
Parthiban S

Replied On September 25, 2017 09:23 AM UTC

Hello and thanks for your reply.

I think my point is not yet clear, sorry probably I have been not abel to explain it clearly, I will try to be as much simplest as possible.

on XAML file I setup the property LabelPosition="Auto".

This means that sync chart automatically locate the label writing in or out the bar.

What I would like to know is:

is it possible at runtime to know if the label writings is inside or outside the label? if you want: how sync is resolving the "Auto" feature? as Inner or as Outer?

Please let me know if this clarify my doubt.



Parthiban Sundaram [Syncfusion]
Replied On November 24, 2017 05:16 AM UTC

Hi Gabriele,

We have checked your scenario at maximum possibilities. Still we are unable to achieve your requirement, due to certain limitations in application level. So, we have logged this as a feature (Need to provide new APIs for customize the label position for each data marker) and it will be available in any of our upcoming release.

Parthiban S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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