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

DateTime

2 Answers 152 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Giuliano Caetano
Top achievements
Rank 1
Giuliano Caetano asked on 16 Jul 2012, 04:37 PM
Hi, Telerik Team.
I have a following definition for my XAxix:

defChart.PlotArea.XAxis.DataLabelsColumn = "DoubleDateTime"; 
defChart.PlotArea.XAxis.IsZeroBased =
false;
defChart.PlotArea.XAxis.AutoScale = true;
defChart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.LongDate;
defChart.PlotArea.XAxis.Appearance.CustomFormat = "dd HH:mm";
defChart.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Inside;

The DateTime objects was converted to ToOADate().

The data source is something like this:
Date             Value
2012-07-11 09:40 22
2012-07-11 09:41 15
2012-07-11 09:43 16
2012-07-11 09:43 17
2012-07-11 09:44 16

Note that, the 09:42 is missing and I have duplicate value to 09:43.

So, I have  problem to show a timeline for DateTime in XAxi (a timeline with one entry for each minute).
I realy need include into data source a entry to 09:42 and agregate the 09:43, to obtain a timeline?

Thanks
Giuliano Caetano
             


2 Answers, 1 is accepted

Sort by
0
Accepted
Hadib Ahmabi
Top achievements
Rank 1
answered on 19 Jul 2012, 09:13 AM
You can build the items manually - for e.g. instead of binding to the exact DateTime value. You can do the following:
Date             Value
1) 2012-07-11 09:40 22
2) 2012-07-11 09:41 15
3) 2012-07-11 09:43 16
4) 2012-07-11 09:43 17
5) 2012-07-11 09:44 16

Create the series programmatically, get the data from your DataSource and then Sort the items by DateTime and add them consequentially:
chart1.Series[k].Items.Add(new ChartSeriesItem(i++, Value); //which is (X value, Y Value)
so instead of specifying a DateTime for X-Value, specify consequential integers. This way you will have one column for each item (you can later rename the X-Axis labels to show the time). 

However, this is only if you are sure that the items are always consequential and one minute apart from each other. 
0
Giuliano Caetano
Top achievements
Rank 1
answered on 19 Jul 2012, 04:52 PM
Hi, Hadib Ahmabi
Thanks for your reply.
 
However, is weird Telerik Chart doesn't permit to use the data type to a Axis and fill the missing values for us, related with the data type selected.

Anyway, I have something like you show me, but i really think that this should be considered by Telerik.

Thanks again for you replay.
Giuliano Caetano
Tags
General Discussions
Asked by
Giuliano Caetano
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Giuliano Caetano
Top achievements
Rank 1
Share this question
or