SQLDataSource Date Column XAxis

Thread is closed for posting
3 posts, 1 answers
  1. Gernot
    Gernot avatar
    32 posts
    Member since:
    May 2008

    Posted 16 Jul 2008 Link to this post

    Hello,
    i've a RadChart with an SQLDataSource.
    The DataSource has Columns like: Hour and Date.

    I created the YAXis wiht Hours 0-24 with the Wizzard and Bound the Hour Column to Y-Axix for Series1.

    Created XAxis in the codebehind Date(example: 1/1/2008 - 1/10/2008)
                    double startTime = DateTime.Parse(Request.QueryString["stichtag"]).AddDays(-1).ToOADate();
                    double endTime = DateTime.Parse(Request.QueryString["stichtagbis"]).AddDays(1).ToOADate();
                    RadChart1.PlotArea.XAxis.AddRange(startTime, endTime, 1);

    But i cant Bound the Date-Column to X-Axis becouse the column does not appear in the Wizzard.

    Any solutions for this?

    Many Thanks
  2. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 17 Jul 2008 Link to this post

    Hi Alaeddin,

    Indeed, RadChart recognizes only numeric columns and that is the reason not to show the DateTime column in the wizard. Still, you can write your query so that the dates are returned in format which allows RadChart to use them -- OleAutomationDate. Here is an example:

    "SELECT [Field], CAST([Date] AS FLOAT) + 2 as float_date FROM [Table_1]"

    Note the "+ 2", it is needed to get the correct dates. Hope this helps.

    Sincerely,
    Ves
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gernot
    Gernot avatar
    32 posts
    Member since:
    May 2008

    Posted 17 Jul 2008 Link to this post

    Great!
    Thank you!

    This works too:
    Setting the x-value in DataBound Event.

    Cheers
    Alaeddin


Back to Top