This is a migrated thread and some comments may be shown as answers.

SQLDataSource Date Column XAxis

2 Answers 136 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Gernot
Top achievements
Rank 1
Gernot asked on 16 Jul 2008, 09:18 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 17 Jul 2008, 11:47 AM
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
0
Gernot
Top achievements
Rank 1
answered on 17 Jul 2008, 12:52 PM
Great!
Thank you!

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

Cheers
Alaeddin


Tags
Chart (Obsolete)
Asked by
Gernot
Top achievements
Rank 1
Answers by
Ves
Telerik team
Gernot
Top achievements
Rank 1
Share this question
or