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

Y axis values are not appearing using ChartDataPoint Binding

I am trying to display date or month in X axis as below, it works fine. I can see the columnseries and weight number on y axis but not months on X axis. I tried alternatively using Date instead of month but I cant see dates either

If i bind directly my AllBodyStats list object by defining binding on XBindingPath an YBindingPath, I can see the dates on X axis. Am I missing something? why it doesnt work using ChartDataPoint


  <chart:SfChart x:Name="Chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">


                <chart:ChartTitle Text="{Binding ChartTitle}"/>


                <chart:DateTimeAxis IntervalType="Months" Interval="1">


                        <chart:ChartAxisTitle Text="{resx:Translate Date}"></chart:ChartAxisTitle>




                <chart:NumericalAxis  Minimum="0" Maximum="{Binding NumericalAxisMax}" Interval="{Binding NumericalAxisInterval}" >


                        <chart:ChartAxisTitle Text="{Binding NumericalAxisTitle}" ></chart:ChartAxisTitle>





                <chart:ColumnSeries ItemsSource="{Binding NumericMonthStats, Mode=OneWay}"  EnableAnimation = "true" AnimationDuration="0.8" >




        public ObservableCollection<ChartDataPoint> NumericMonthStats{ get; set; }

           foreach (var BodyStat in AllBodyStats.OrderBy(o=>o.DateCreated))
                string month = BodyStat.DateCreated.ToString("MMMM", Helpers.Settings.CurrentCultureInfo);

                    NumericMonthStats.Add(new ChartDataPoint(month, (double)BodyStat.Weight)); // using month
                    NumericMonthStats.Add(new ChartDataPoint(BodyStat.DateCreated.Date, (double)BodyStat.Weight)); // using date

using my custom list object


            <chart:ColumnSeries ItemsSource="{Binding AllBodyStats}" XBindingPath="DateCreated" YBindingPath="Weight">


1 Reply

SP Saravana Pandian Murugan Syncfusion Team August 1, 2017 01:32 PM UTC

Hi Emil, 
Thanks for contacting Syncfusion support. 
We are not able to reproduce the reported issue at our end and we have prepared a sample for this. Please update us the modified sample to reproduce the issue which will be helpful for providing further assistance on this. 
Note: If you bind the custom object, you should bind the model properties. If you bind Data using ChartDataPoint and update the data dynamically, you should set XBindingPath as “XValue” and YBindingPath as “YValue” as per the below code. But we always recommend you to set XBindingPath as “XValue” and YBindingPath as “YValue” if you bind ChartDataPoint object. 
Code Example:  
          <chart:ColumnSeries ItemsSource="{Binding NumericMonthStats}" XBindingPath="XValue" YBindingPath="YValue"> 
         <chart:LineSeries ItemsSource="{Binding NumericMonthStats1}" XBindingPath="Date" YBindingPath="Weight"/> 
Please check the attached sample. If you are still facing this issue, please update us the modified sample. 
Saravana Pandian M. 

Live Chat Icon For mobile
Up arrow icon