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

Decimal numbers separator

Thread ID:

Created:

Updated:

Platform:

Replies:

132751 Sep 19,2017 12:09 PM UTC Sep 28,2017 05:47 AM UTC Xamarin.Forms 9
loading
Tags: SfChart
Javier
Asked On September 19, 2017 12:09 PM UTC

Hi,

Is it posible to set always "," as default decimal separator regardless the OS language (culture)?

Currently I´m using "LabelFormat = "#,###.##"" to establish the label style, however the decimal separator number changes with the OS culture (English = "." Spanish = ",")

Thank you.

Parthiban Sundaram [Syncfusion]
Replied On September 20, 2017 01:05 PM UTC

Hi Jaiver,   
  
 
Thanks for using Syncfusion products.   
   
You can achieve this requirement by specifying the culture info when formatting the string. The labels of the axis can be accessed from LabelCreated event of ChartAxis. Please refer the following code snippet.  
   
Code Snippet:   
   
   
        private void YAxis_LabelCreated(object sender, Syncfusion.SfChart.XForms.ChartAxisLabelEventArgs e)   
        {   
            double value = Convert.ToDouble(e.LabelContent);   
            e.LabelContent = value.ToString("#,###.##"new CultureInfo("en-US"));   
        }   
 
    
We have created a simple demo sample to demonstrate this. Please download it from below location.  
  
   
Please let us know, if you need further assistance on this.  
  
Regards,   
Parthiban S  
 


Javier
Replied On September 21, 2017 01:59 PM UTC

Hi,

It works great.

Thank you!


Parthiban Sundaram [Syncfusion]
Replied On September 22, 2017 06:44 AM UTC

Hi Jaiver, 
 
Thanks for the update. We are glad that the given solution has helped to achieve your requirement. Please let us know, if you need further assistance on this. 
 
Regards, 
Parthiban S 


Javier
Replied On September 22, 2017 08:47 AM UTC

Hi,

One more cuestion please. What about formatting "StackingBarSeries -> DataMarker" and "StackingBarSeries -> ToolTip" specifying the culture info?

Thanks.


Parthiban Sundaram [Syncfusion]
Replied On September 25, 2017 12:52 PM UTC

Hi Jaiver,   
   
Thanks for the update.   
   
You can achieve this requirement by setting a DataTemplate with an IValueConverter for both data marker label and tooltip using ChartDataMarker.LabelTemplate and ChartTooltipBehavior.TooltipTemplate properties respectively. Please refer the following code snippet for more details   
   
Code snippet:   
   
DateTemplate   
   
   
    <ResourceDictionary>   
     <local:DataMarkerConverter x:Key="labelConverter"></local:DataMarkerConverter>   
      <DataTemplate x:Key="LabelTemplate">   
        <StackLayout>   
            <Label Text="{Binding YValue, Converter={StaticResource labelConverter}"/>   
        </StackLayout>   
      </DataTemplate>   
    </ResourceDictionary>   
   
  
   
Converter  
   
   
        public object Convert(object value, Type targetType, object parameter, CultureInfoculture)   
        {   
            double yValue = System.Convert.ToDouble(value);   
            return yValue.ToString("#,###.##"new CultureInfo("en-US"));   
        }   
  
   
   
We have created a simple demo sample to demonstrate this. Please download it from below location.     
   
   
Please let us know, if you need further assistance on this.  
  
Regards, 
Parthiban S  


Javier
Replied On September 26, 2017 09:36 AM UTC

Thank you. Could you please post the equivalent for C# code?


Parthiban Sundaram [Syncfusion]
Replied On September 27, 2017 01:11 PM UTC

Hi Jaiver,

Thanks for the update.

As per your requirement, we have prepared the sample with code behind (C#). Please download the sample from following location.

Sample: http://www.syncfusion.com/downloads/support/forum/132751/ze/ChartSample-1678669771

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

Regards,
Parthiban S


Javier
Replied On September 27, 2017 04:48 PM UTC

Works perfect.

Thank you for the excellent assistance.


Parthiban Sundaram [Syncfusion]
Replied On September 28, 2017 05:47 AM UTC

Hi Jaiver,

Thanks for the update. We are glad that the given solution has helped to achieve your requirement. Please let us know, if you need further assistance on this.

Regards,
Parthiban S

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

;