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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding text to DataMarker

Thread ID:

Created:

Updated:

Platform:

Replies:

124670 Jun 21,2016 07:04 PM UTC Aug 3,2016 02:17 PM UTC Xamarin.Forms 5
loading
Tags: SfChart
Drew Wilson
Asked On June 21, 2016 07:04 PM UTC

How can I add additional text to data markers on a doughnut chart? Currently I have

...
<chart:ChartDataMarker LabelContent="YValue">
...

which displays a number as the data marker but I need to format that number to represent money.

So, essentially, I need to add a "$" before the number on the marker but something like the following does not work (obviously)

...
<chart:ChartDataMarker LabelContent="$YValue">
...

Thanks!

Jaikrishna Chandrasekar [Syncfusion]
Replied On June 22, 2016 12:43 PM UTC

Hi Drew Wilson,  
   
Thanks for contacting Syncfusion support.   
   
We can add additional text to datamarker label. The LabelStyle of ChartDataMarker has a Property called LabelFormat which is used to format the datamarker labels. By using this LabelFormat, we can add $ symbol as prefix to the datamarker label.   
  
The following code illustrates how to add $ symbol as prefix to datamarker labels.   
  
XAML   
<chart:DoughnutSeries  ItemsSource="{Binding data}">
        <chart:DoughnutSeries.DataMarker>
               <chart:ChartDataMarker>
                       <chart:ChartDataMarker.LabelStyle>
                              <chart:DataMarkerLabelStyle LabelFormat ="$"/>
                       </chart:ChartDataMarker.LabelStyle>
                </chart:ChartDataMarker>
        </ chart:DoughnutSeries.DataMarker>
</ chart:DoughnutSeries  >  
 
 
  
   
   
C#   
DoughnutSeries series = new DoughnutSeries ();
series.ItemsSource = data;
series.DataMarker = new ChartDataMarker () {
           LabelStyle = new DataMarkerLabelStyle (){LabelFormat="$"},
};  
 
 
  
   
   
Regards   
Jaikrishna C   
 


Drew Wilson
Replied On June 22, 2016 03:17 PM UTC

Worked perfectly!

Gobi M [Syncfusion]
Replied On June 23, 2016 05:04 AM UTC

Hi Drew Wilson,  
 
Thanks for the update. 
 
Please let us know for any queries. 
 
Regards, 
Gobi M 
 


Drew Wilson
Replied On August 2, 2016 06:16 PM UTC

I would like to further format this as currency by adding commas every 3 digits and two decimal places. Is it possible to do something like:

  <chart:DataMarkerLabelStyle LabelFormat ="$###,###.##"/>

Thanks

Yuvaraj Palanisamy [Syncfusion]
Replied On August 3, 2016 02:17 PM UTC

Hi Drew Wilson, 
 
We have prepared a sample as per your requirement. Please find the sample from the below location, 
 
  
Thanks, 
Yuvaraj 
  


CONFIRMATION

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.

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

;