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
close icon

How to formatting the Data Market value

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?



1 Reply

MP Michael Prabhu M Syncfusion Team 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 




Loader.
Live Chat Icon For mobile
Up arrow icon