problem regarding Date on X-Axis

Thread is closed for posting
4 posts, 0 answers
  1. Albert
    Albert avatar
    65 posts
    Member since:
    Aug 2008

    Posted 12 Jan 2009 Link to this post

    How do I place a date on x using this.

    this.DataManager.ValuesXColumn  = "Date"

    And no, I cannot preconvert it using SQL and no I cannot use the .ToDateOA command. I can only use a reference to the column name.
  2. Vladimir Milev
    Vladimir Milev avatar
    1061 posts

    Posted 15 Jan 2009 Link to this post

    Hello Albert,

    Using the ToOADate method is the only way to convert a DateTime class instance to a double precision floating point number. Since there is no support for this conversion out of the box I am afraid this is your only option. Check the ItemDataBound event - there you can convert DateTime values to double values and set them to your XValues manually.

    Vladimir Milev
  3. Stefan Willebrand
    Stefan Willebrand avatar
    20 posts
    Member since:
    Sep 2008

    Posted 16 Jan 2009 Link to this post

    How can I access the dates in ItemDataBound to convert them? Can you give me a code example?
  4. Ves
    Ves avatar
    2926 posts

    Posted 19 Jan 2009 Link to this post

    Hello Stefan,

    Here is an example:

    void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e) 
            if (e.SeriesItem != null
                e.SeriesItem.XValue = Convert.ToDateTime(((DataRowView)e.DataItem)["Date"]).ToOADate(); 

    Hope this helps.

    Kind regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top