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

problem regarding Date on X-Axis

3 Answers 64 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Albert
Top achievements
Rank 1
Albert asked on 12 Jan 2009, 06:24 AM
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.

3 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 15 Jan 2009, 07:18 AM
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.

Regards,
Vladimir Milev
0
Stefan Willebrand
Top achievements
Rank 1
answered on 16 Jan 2009, 08:30 AM
How can I access the dates in ItemDataBound to convert them? Can you give me a code example?
0
Ves
Telerik team
answered on 19 Jan 2009, 10:05 AM
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,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Albert
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Stefan Willebrand
Top achievements
Rank 1
Ves
Telerik team
Share this question
or