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 formatting the Data Market value

Thread ID:

Created:

Updated:

Platform:

Replies:

141164 Nov 27,2018 04:39 PM UTC Nov 28,2018 08:38 AM UTC Xamarin.Forms 1
loading
Tags: SfChart
Luis David De La Cruz Bautista
Asked On November 27, 2018 04:39 PM UTC

Hello to all SF team, I have been troubling formatting the values of my chart

I've tried with the next code:
ChartTrackballBehavior behavior = new ChartTrackballBehavior();
behavior.LabelStyle = new ChartTrackballLabelStyle();
behavior.LabelStyle.LabelFormat = "0:0,0";


In example in my ViewModel I fill the chart with values

Serie1.Add(new M_Chart() { Date= item.Fecha_NuevoFormato, TipoCambio = 500000});


But my result still the value I inserted


I want to format the charts values like the next way

Input
500000
700000
Output
500,000
700,000

Wich is the property I must to modify?



Michael Prabhu M [Syncfusion]
Replied On November 28, 2018 08:38 AM UTC

Hi Luis, 

Greetings from Syncfusion, we have achieved your requirement by applying the format for the label in TrackballCreated event which is available in chart. We have prepared a simple sample for your requirement and it can be downloaded from the below link. 

Sample: 141164_Format 

Code snippet[XAML] 
<chart:SfChart TrackballCreated="Chart_TrackballCreated" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> 
 
<chart:SfChart.ChartBehaviors> 
     <chart:ChartTrackballBehavior/> 
</chart:SfChart.ChartBehaviors> 
 

Code snippet[C#] 
private void Chart_TrackballCreated(object sender, ChartTrackballCreatedEventArgs e) 
{ 
     foreach (var info in e.ChartPointsInfo) 
     { 
        var label = Convert.ToDouble(info.Label); 
        info.Label = label.ToString("###,###"); 
     } 
} 
 

Note: You have can able to apply any of the following standard numeric format strings for the Label. 

Screenshot: 

 

Thanks, 
Michael 




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.

Please sign in to access our forum

This page will automatically be redirected to the 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

;