DateTime on XAxis - ToOADate?

Thread is closed for posting
3 posts, 1 answers
  1. Chris
    Chris avatar
    16 posts
    Member since:
    Apr 2008

    Posted 22 Apr 2008 Link to this post


    I am trying to bind a simple data source to a line series chart control, and I'm having a lot of difficulties getting the DateTime field to work.   The stored procedure is very simple and returns a DateTime column and an int column that I want to chart on the Y axis.

    From what I can gather the chart control needs dates in the OLE Automation date/time format?  How do I do this for a data bound chart?  I found this example:

    but it only shows you how to do this programatically with fixed dates.  Is there anything I can do to convert the DateTime field in SQL in my stored procedure in a format that the chart control understands?


  2. Answer
    Giuseppe avatar
    2363 posts

    Posted 23 Apr 2008 Link to this post

    Hi Chris,

    You can use the following SQL cast to pass the DateTime value in the numeric format that can be handled by the RadChart control:

         CAST(as_of_date AS FLOAT) + 2 as float_date   

    Hope this helps.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Chris
    Chris avatar
    16 posts
    Member since:
    Apr 2008

    Posted 24 Apr 2008 Link to this post

    Thanks!!  That worked great - at first the dates were all coming through as the year 1899 when I first tried this, but I found out that I had to change the IsZeroBased property to false, and the dates started coming through as expected.


Back to Top