How to control zoom level depending on data

4 posts, 1 answers
  1. Robert
    Robert avatar
    15 posts
    Member since:
    Jul 2012

    Posted 11 Jul 2012 Link to this post

    I'm currently using the mvvm pattern along with the Timeline to display time based information.
    I can't seem to find a good way of displaying the varying sets of data with a preset zoom level.

    Sometimes, the dataset will contain values that are within seconds of one another. In this case, I would want to zoom level to show 6 gaps of 10 seconds. Other times, my dataset may have values that are minutes within one another or hours within one another. I would want the zoom level to be lower so that I can see all of the data at the first glance.

    Using the mvvm pattern, I set RadTimeline.Intervals once in the XAML but they don't necessarily suit my needs for all the varying sets of data.

    For example, say my Intervals are:
    <telerik:MinuteInterval/>
    <telerik:SecondInterval/>

    I then set the Start and End periods to be that of the first and last data point.


    Is it possible to change the Interval time depending on the data that is being displayed?
  2. Robert
    Robert avatar
    15 posts
    Member since:
    Jul 2012

    Posted 11 Jul 2012 Link to this post

    I suppose a workaround would be to have several Timeline widgets. Each one would have a different interval set. Depending on my data, I will "show" the Timeline with the the proper display and "hide' the other ones.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 12 Jul 2012 Link to this post

    Hi Robert,

    You can bind the PeriodStart and PeriodEnd properties of the timeline to properties of your view model. You can do this for the VisiblePeriodStart and VisiblePeriodEnd properties as well - they specify the current visible range in the timeline control and thus, the zoom level.

    Regarding the intervals collection - you can add all interval types that you might need to the intervals collection - the timeline control will determine the best view, depending on the current visible range and the whole range. Thus, the additional interval types in the intervals collection will not be a problem.

    Kind regards,
    Tsvetie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Robert
    Robert avatar
    15 posts
    Member since:
    Jul 2012

    Posted 12 Jul 2012 Link to this post

    Hello Tsvetie,

    I've been able to use the IntervalSpans to get the result I'm looking for.

    Thanks!
Back to Top