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

Is it possible to bind XBindingPath="{Binding Key, StringFormat='{0:MMM yyyy}'}" in SfChart Series

Thread ID:

Created:

Updated:

Platform:

Replies:

132431 Sep 1,2017 02:19 AM Sep 7,2017 02:31 AM Xamarin.Forms 3
loading
Tags: SfChart
Balamuraleekrishna K R
Asked On September 1, 2017 02:19 AM

Is it possible to bind XBindingPath="{Binding Key, StringFormat='{0:MMM yyyy}'}" in

           <chart:SfChart.Series>
                            <chart:SplineSeries x:Name="splineSalesGraph"
                                                ItemsSource="{Binding MonthWiseSummaryList}" 
                                                XBindingPath="Key"
                                                YBindingPath="Value"
                                                EnableAnimation="True" EnableTooltip="False">
                            </chart:SplineSeries>
           </chart:SfChart.Series>

where Key is a property in :

namespace System.Collections.Generic
{
     public struct KeyValuePair<TKey, TValue>
    {
          public KeyValuePair(TKey key, TValue value);

          public TKey Key { get; }
        
          public TValue Value { get; }
 
          public override string ToString();
    }
}

in ViewModel : 

            MonthWiseSummaryList = new List<KeyValuePair<DateTime, double>>();
            MonthWiseSummaryList.Add(new KeyValuePair<DateTime, double>(new DateTime(2017, 03, 01), 383884.00));



Parthiban Sundaram [Syncfusion]
Replied On September 4, 2017 06:43 AM

Hi Balamuraleekrishna,

Thanks for using Syncfusion products.

You can achieve your requirement by using LabelStyle.LabelFormat propertyof DateTimeAxis. Please find the below code snippet.

Code Snippet:

 
  
        <chart:DateTimeAxis> 
  
          <chart:DateTimeAxis.LabelStyle> 
  
            <chart:ChartAxisLabelStyle LabelFormat="MMM yyyy"/> 
  
          </chart:DateTimeAxis.LabelStyle> 
  
        </chart:DateTimeAxis> 
  
 

Sample: http://www.syncfusion.com/downloads/support/forum/132431/ze/LabelStyle-1150041112

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

Regards,
Parthiban S

Balamuraleekrishna K R
Replied On September 6, 2017 01:38 AM

Thank you sir..... Really helpful.


Parthiban Sundaram [Syncfusion]
Replied On September 7, 2017 02:31 AM

Hi Balamuraleekrishana,

Thanks for the update. We are glad that the given solution has helped to achieve your requirement. Please let us know for your further assistance.

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

;