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

Date not binding properly at X val using EF 5 bound datasource

Thread ID:





108725 May 8,2013 10:33 PM UTC May 30,2013 04:35 AM UTC WinForms 3
Tags: Chart
Dennis Beaugrand
Asked On May 8, 2013 10:33 PM UTC

I have a simple test app which adds rows to  table NmsSummaries with Date as Xval  and a random number used for Y.

ChartControl is bound to this through EF5  to display a simple line chart. 
I also have a  Datagridview bound to the same source so I can see what is happening in real time.
The chart is updating as I add rows and I see the new Y value corresponding to the random value generated  but the x value dates are all starting at Dec30 1899!

A similar test using datasets works properly adding points at current date
Any ideas what is wrong?

Code below
Public Class Form1

    Dim context As IdirectLocalDbDAL.LocalDbEntities

    Sub InitChart()

        Dim model As New ChartDataBindModel(context.NmsSummaries.Local.ToBindingList)
        Dim X = model.XIndex

        model.XName = "TheDate"
        model.YNames = New String() {"MaxCn"}

        Dim series As New ChartSeries("Series")

        series.Text = series.Name
        series.SeriesIndexedModelImpl = model

        series.Type = ChartSeriesType.Line
        ChartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime


    End Sub

Anandaraj T [Syncfusion]
Replied On May 14, 2013 07:07 AM UTC

Hi Dennis,

Thanks for using Syncfusion products.

When value type of x axis is set to date time, then data bound with x axis should be also of type "DateTime". If data bound with x axis is not of type "DateTime" and x axis value type is set to date time, then labels will be displayed starting from December 30 1899 by default.

From the code snippet provided by you, the column "TheDate" is bound with x axis. If the values of this column is not of type "DateTime", we suggest you to set the value type of x axis to "Custom".

For more information about data binding, please refer our online documentation in the following link:
Binding a DataSet to the Chart

Please let us know if you have any concerns.


Dennis Beaugrand
Replied On May 27, 2013 11:20 PM UTC

Problem was that I was using indexed model and first Date index is apparently 1900.
I switched to seriesmodel and all is working fine.

Anandaraj T [Syncfusion]
Replied On May 30, 2013 04:35 AM UTC

Hi Dennis,

Thanks for the update. We are glad to know that your issue has been resolved.

Please let us know if you have any concerns.



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

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