Does the TimeBar go as far down as showing hours, minutes, seconds? At a minimum I need to be able to go as far as showing hours within the same day. If it doesn't support it, it would be great to be able to pick the min and max steps that it can go. Perhaps when drilling down into a day, it breaks it down to hours then minutes, then seconds but expanding past a day only shows days.
Cheers,
Clint
24 Answers, 1 is accepted
Thanks a bunch for taking a look at RadTimeBar. We indeed considered hours, minutes etc. however, we didn't really have a clear idea what would be useful to our customers. There are several ways these can be implemented:
1) We could simply add hours, minutes, seconds etc. however the ratios between days, hours, minutes are quite big sometimes: 1:24, 1:60, etc. This and the fact that the format strings for hours, minutes etc. are not as short as the format strings for days makes a weird looking timebar with very long groups and very short and clustered items.
2) Alternatively we can introduce more granular units such as: half day, quarterday, 3 hours, 6 hours, half an hour, 15min, etc. etc. It is tricky to get these right and we would like to see some more feedback on this from the community.
Once again, we appreaciate everyone joining in this discussion.
All the best,
Vladimir Milev
the Telerik team
I would also be interested to have that granularity in your timebar, not sure if visually half day would be enough and note that some culture naturally divide the day in 4 quarters (not just AM/PM) so I would vote for a 1/4 ratio.
regards
Jean-Marc
I need to illustrate how flight traffic changes for an airport over a day, we get the data on 30 min intervals, so to get the control to go down to hours would be nice. Tried to add the
<telerik:HourInterval />but I guess its not implemented yet, finest interval I get is the day interval.
I totally understand the problem of showing to fine intervals with nice formatting, so seconds and minutes is probably too granular, but at least I think hours should be included. Maybe with an option of grouping hours together, so that like
<telerik:HourInterval HourGrouping="3" />only would go down to "3 am", "6 am" and so on.
Great control by the way!
/Paul
We WILL include more granular time periods. The control was released as BETA and we decided that we first want to hear what our customers have to say about the feature. We like the feedback so far and we will try to incorporate all ideas into the control.
Regards,
Vladimir Milev
the Telerik team
Currently we can commit to a Q2 release for the smaller time intervals. We are still researching, testing, and trying a few things and intesively collecting feedback.
Kind regards,
Vladimir Milev
the Telerik team
My task requires me to display intervals with granularity going down to the second in the RadTimeBar control. I was wondering how collecting of the feedback goes and what intervals would be available in the release. Can you please give me an idea of what certain intervals would be included in the nearest time?
At the moment I was able to implement what I need by inheriting from IntervalBase class and defining my own custom intervals. Unfortunately IntervalBase class is defined internal and because of that I had to make a custom build of the RadTimeBar which I try avoid. So my second question is if that would be possible just to make IntervalBase public in the future release to give users an ability to create their custom intervals?
Thanks in advance,
Alexander
We will include seconds for sure. For the moment we intentionally left the class internal - so that we retain control on how extensibility is done. We are curious to see your implementation of a custom interval. Once we get a grip on how customers use the feature and would like to customize the control we will provide some points for extensibility.
Greetings,
Vladimir Milev
the Telerik team
Thank you for your response.
Working separately I feel that I used the way #1 at your post from Mar 17 first and that caused exactly the described behavior - long groups and short items. It even won't show me minutes within an hour until 30 of them were able to fit the screen. Otherwise I had just a long-long hour item which even had the label out of the sight area. When I used the approach that you describe as the way #2 and introduced HalfHourInterval, DozenMinuteInterval, MinuteInterval, TenSecondInterval, SecondInterval. Which led to much nicer look and feel due to less time difference between intervals.
I posted my implementation for the TenSecondInterval interval below. It's quite straightforward and just follows the conventions that are defined in out of the box intervals from version 2011.1.419. The other intervals are implemented in a similar way.
I can't say that these intervals are examples from real life scenarios. That was just part of my research for the future task. I am looking forward to know what exactly would be the extensibility points in the release. And can you please point we with an approximate date when this feature becomes available?
Thanks,
Alexander
/// <summary>
/// Defines an interval of 10 seconds.
/// </summary>
public
class
TenSecondInterval : IntervalBase
{
private
static
readonly
Func<DateTime,
string
>[] formatters;
private
const
int
Weight = 1350;
private
const
int
RowCount = 6;
static
TenSecondInterval()
{
formatters =
new
Func<DateTime,
string
>[]
{
date => date.ToString(
"HH:mm:ss.fff"
),
date => date.ToString(
"HH:mm:ss"
),
date => date.ToString(
"mm:ss"
),
date => date.ToString(
"ss"
)
};
}
/// <summary>
/// Gets the code that identifies this interval uniquely.
/// </summary>
/// <value>The code.</value>
internal
override
int
Code
{
get
{
return
Weight;
}
}
/// <summary>
/// Gets a collection of formatters used to convert DateTime objects
/// to specific strings.
/// </summary>
/// <value>The formatters.</value>
internal
override
Func<DateTime,
string
>[] Formatters
{
get
{
return
formatters;
}
}
/// <summary>
/// Gets the smallest period.
/// </summary>
/// <value>The smallest period.</value>
internal
override
TimeSpan SmallestPeriod
{
get
{
return
TimeSpan.FromSeconds(10);
}
}
/// <summary>
/// Creates the string measurement table.
/// </summary>
/// <returns></returns>
internal
override
string
[,] CreateStringMeasurementTable()
{
string
[,] secondsList =
new
string
[
this
.Formatters.Length, RowCount];
DateTime sampleDate =
new
DateTime(2000, 10, 30, 0, 0, 0);
for
(
int
secondIndex = 0; secondIndex < RowCount; secondIndex++)
{
for
(
int
formatIndex = 0; formatIndex <
this
.Formatters.Length; formatIndex++)
{
secondsList[formatIndex, secondIndex] =
this
.Formatters[formatIndex](sampleDate);
}
sampleDate = sampleDate.AddSeconds(10);
}
return
secondsList;
}
/// <summary>
/// Extracts the interval start from the specified DateTime object.
/// </summary>
/// <param name="date">The date.</param>
/// <returns></returns>
internal
override
DateTime ExtractIntervalStart(DateTime date)
{
return
new
DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second - (date.Second % 10));
}
/// <summary>
/// Increments the specified date.
/// </summary>
/// <param name="date">The date.</param>
/// <returns></returns>
internal
override
DateTime IncrementByInterval(DateTime date)
{
return
date.AddSeconds(10);
}
}
Thanks,
Alexander
For the upcoming release we are going to include smaller periods - minutes and seconds. The release will be approximately at the mid of July. We are also planning to introduce IntervalSpan property which will provide functionality for grouping the interval items together. For example you will be able to group the seconds by 10.
Best wishes,
In terms of 'collecting of the feedback' from end-users and how they might need to use the TimeBar I would like to mention the following.
The TimeBar is exactly what I want and I have specific needs for Time ranges of 10's of seconds with TimeIntervals down to the second. For example end-users of my application have hundreds of trials of 5000-10000 data points collected over 5-40 second periods.
Thanks for a great component, looking forward to the next release.
Thank you for your feedback. It is highly appreciated. From the described scenario I understand that you need seconds interval and a possibility for grouping it by more than one span, e.g. "1,5,10" . This will be available for the upcoming release. If my assumption is not correct, could you please provide more details about this scenario? Thank you in advance.
Regards,
So it seems that you have added the new intervals, but they do little good unless I am missing something.
Due to a limitation in Silverlight framework, we have enforced a constraint for zoom-in to maximum of 30 000 pixels. Depending on the period range that the timebar shows, the minimum interval that can be displayed, might be different from the minimum interval that you have added in the Intervals collection. I suppose the period range of your timebar is large and when you try to zoom in to minutes and seconds, you hit the 30 000 pixel limit.
Best wishes,
Tsvetie
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Certainly seems to be.
We are plotting 3 months worth of data at 15 minute intervals, would like the ability to zoom in to hourly and then restrict selections to 8 hour blocks [used to display the same data with a RadChart kept in sync]
Restricting the overall range to 1 month and it works.
Yes, you are correct - the constraint is applied in both the Silverlight and WPF versions of the control and currently, there is no way to influence this, with the exception of modifying the source code, of course. Basically, there is no reason for this constraint in WPF, but consistency. Once we introduce UI virtualization for RadSparkline, this constraint will no longer be necessary. However, for the time being, I cannot give you an estimate for this feature.
Kind regards,
Tsvetie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I am running the 725 release from this year, where EnableSparklineVirtualization is set to true,
and I can't zoom into days based on the amount of data.
Is there something I need to do? or is there still a limit to the depth one can go?
We removed the constraint for the WPF version of the control with Q2 2012 SP2. In order to take advantage of this improvement, one should specify a custom MinZoomRange value for the timeBar control. The default behavior of the control has not changed.
However, the constraint is still respected for the Silverlight version of the control. There are two reasons for that:
- EnableSparklineVirtualization controls only data virtualization for the sparkline. We have not yet introduced UI virtualization for the sparkline-in-timeBar scenario.
- RadTimeBar is a content control - you can add any content to it and that includes content that is not virtualized. Thus, for the general case, we cannot remove the constraint for the Silverlight version of the control.
What I can tell you, is that once we have completed the task, described in the first bullet list item, we will consider implementing a means for disabling the constraint in the sparkline-in-timeBar specific case.
Tsvetie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
We are using RadTimeBar Control in which we are showing daily shifts interval which are currently hardecoded as 8 which sows three slots in the bar for 24 hours.
But now we wanted this as 4,6,4,6,4.
So could you please suggest the solution for custumizing intervals it will be helpful if you share xaml code also.
Telerik Helpdesk shared following sample but still I am not getting as I am new to WPF as well as to Telerik controls
public class TimeBarDayCustomInterval : IntervalBase {
private static readonly Func<DateTime, string>[] formatters;
static TimeBarDayCustomInterval()
{
formatters = new Func<DateTime, string>[]
{
date => date.ToString("ddd, d"),
date => date.Day.ToString(),
};
}
public override Func<DateTime, string>[] Formatters
{
get
{
return formatters;
}
}
public override TimeSpan MinimumPeriodLength
{
get
{
return TimeSpan.FromDays(1);
}
}
public override DateTime ExtractIntervalStart(DateTime date)
{
return date.Date;
}
public override DateTime IncrementByInterval(DateTime date, int intervalSpan)
{
return date.AddDays(intervalSpan);
}
}
Thanking you in advance
Regards
Sunil Gore
I am using RadTimeBar Control in which we are showing daily shifts interval which are currently hardcoded(Fixed) as 8 which shows three slots in the bar for 24 hours.
But now we wanted this as 4,6,4,6,4.
So could you please suggest the solution for custumizing intervals it will be helpful if you share xaml code also.
Telerik Helpdesk shared following sample but still I am not getting as I am new to WPF as well as to Telerik controls
public class TimeBarDayCustomInterval : IntervalBase {
private static readonly Func<DateTime, string>[] formatters;
static TimeBarDayCustomInterval()
{
formatters = new Func<DateTime, string>[]
{
date => date.ToString("ddd, d"),
date => date.Day.ToString(),
};
}
public override Func<DateTime, string>[] Formatters
{
get
{
return formatters;
}
}
public override TimeSpan MinimumPeriodLength
{
get
{
return TimeSpan.FromDays(1);
}
}
public override DateTime ExtractIntervalStart(DateTime date)
{
return date.Date;
}
public override DateTime IncrementByInterval(DateTime date, int intervalSpan)
{
return date.AddDays(intervalSpan);
}
}
Thanking you in advance
Regards
Sunil Gore
I am not quite sure I understand the problem that you report completely. That is why, please correct me if I misunderstood your requirement.
In case I understand you correctly, you want to implement a custom interval type that has irregular items. This custom interval would generate five items for every day - three items with 4 hour duration and two items with 6 hour duration.
If this is that case, you could try implementing a custom interval using the template that you already have. Your custom interval could look like the following:
public
class
TimeBarHourCustomInterval : IntervalBase
{
private
static
readonly
Func<DateTime,
string
>[] formatters;
static
TimeBarHourCustomInterval()
{
formatters =
new
Func<DateTime,
string
>[]
{
date => date.ToString(
"HH"
)
};
}
public
override
Func<DateTime,
string
>[] Formatters
{
get
{
return
formatters;
}
}
public
override
TimeSpan MinimumPeriodLength
{
get
{
return
TimeSpan.FromHours(1);
}
}
public
override
DateTime ExtractIntervalStart(DateTime date)
{
return
new
DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0);
}
public
override
DateTime IncrementByInterval(DateTime date,
int
intervalSpan)
{
if
(intervalSpan == 1)
{
if
(date.Hour == 0)
return
date.AddHours(4);
else
if
(date.Hour == 4)
return
date.AddHours(6);
else
if
(date.Hour == 10)
return
date.AddHours(4);
else
if
(date.Hour == 14)
return
date.AddHours(6);
return
date.AddHours(4);
}
return
date.AddHours(intervalSpan);
}
}
Please note that this scenario is not supported by the control and you need to test it thoroughly before you decide whether you could you it in your application.
Regards,
Tsvetie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Thanks for the solution it worked for me :)
Great Help!!
Now I want my timebar intervals to appear as attached.
Please suggest how to add the caption for intervals as shown in the attached image (1st Image)
Thanking you in advance.
Regards
Sunil Gore
Correction to previous reply. (Want timebar as following image)
1st Image => Timebar With Start and End Intervals with AM-PM.jpg
Regards
Sunil Gore
Using following xaml code
<telerik:RadTimeBar Grid.Column="1" x:Name="TimeBar" Height="60" SelectionChanged="TimeBar_SelectionChanged">
<telerik:RadTimeBar.Intervals>
<telerik:DayInterval/>
<local:TimeBarHourCustomInterval/>
</telerik:RadTimeBar.Intervals>
</telerik:RadTimeBar>
In order to change the format of the strings in your custom interval, you need to change the formatters collection. In the code that I sent you, I used "date => date.ToString("HH")". You can change this string according to your scenario. For information on format strings please refer to the following online resources:
- http://msdn.microsoft.com/en-us/library/vstudio/az4se3k1(v=vs.110).aspx
- http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
Regards,
Tsvetie
Telerik
Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).