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. Image for the cookie policy date

Append string to data marker label

How do i append a string to the data marker label of barSeries

currently my label is shown as 93.09. i want it to display as 93.09 %

setting LabelContent to Percentage has caused the data marker to go all wrong.

1 Reply

MK Muneesh Kumar G Syncfusion Team September 4, 2019 10:39 AM UTC

Hi Benjamin, 
 
Greetings from Syncfusion, 
  
We have analyzed your requirement and you can achieve this by setting LabelTemplate for DataMarker label and include the % symbol in template customization as per the below code snippet.  
 
Code snippet 
 
<ContentPage.Resources> 
    <ResourceDictionary> 
        <DataTemplate x:Key="dataMarkerTemplate"> 
            <StackLayout Orientation="Horizontal"> 
                <Label Text="{Binding Value}" VerticalOptions="Center" FontSize = "15"/> 
                <Label Text=" %" VerticalOptions="Center" FontSize = "15"/> 
            </StackLayout> 
        </DataTemplate>     
    </ResourceDictionary> 
</ContentPage.Resources> 
 
<chart:SfChart.Series> 
    <chart:BarSeries ItemsSource="{Binding Data}" XBindingPath="Name" YBindingPath="Value"> 
        <chart:BarSeries.DataMarker> 
            <chart:ChartDataMarker ShowLabel="True" LabelTemplate="{StaticResource dataMarkerTemplate}">  
            </chart:ChartDataMarker> 
        </chart:BarSeries.DataMarker> 
    </chart:BarSeries> 
</chart:SfChart.Series> 
 
 
 
Please let us know if you have any other queries.  
 
Thanks,  
Muneesh Kumar G  
 


Loader.
Live Chat Icon For mobile
Up arrow icon