How can I set PanOffset according to current Data

4 posts, 0 answers
  1. Vadim
    Vadim avatar
    8 posts
    Member since:
    Feb 2009

    Posted 06 Mar 2012 Link to this post

    Hello, 
    I have an issue for ChartView - set scrollbar position according to current selection in GridView.
    ChartView has horizontal DateTimeContinuousAxis. GridView contains Range Column (from, to).
    Do you have any ideas, how to help me?

    Thanks,
    Vadim
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 09 Mar 2012 Link to this post

    Hi Vadim,

    If I understand correctly - you have a chart view and a grid view and the grid view contains information about some timely intervals - such as a start date and an end date. When a row is selected - you need the chart to zoom into the selected interval.

    There is no out-of-the-box feature that allows such a behavior. However, there are ways to achieve this. One is to manipulate the Zoom and PanOffset properties of the chart.

    I have attached a project that demonstrates this. The grid view contains information about start date and end date. When I select a row - the start date and end date are extracted from the selected row. Then, based on the current chart axis width - the new Zoom and PanOffset are calculated and then set.

    I hope this helps.

    Greetings,
    Petar Marchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Vadim
    Vadim avatar
    8 posts
    Member since:
    Feb 2009

    Posted 13 Mar 2012 Link to this post

    Hi Petar,

    Thanks a lot for the solution. It works for me in most cases.
    But in some cases we need to display at X-Axis up to 5 or 15 minutes intervals. For this purpose Zoom and Pan doesn't work as expected. (Scroll is located far from the current interval). What can I do to change this behavior?

    Best regards,
    Vadim
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 16 Mar 2012 Link to this post

    Hi Vadim,

    Did you try to set the MinimumRangeSpan to a smaller value? In the previously provided project I have placed a style targeting a PanZoomBar in the user control's resources. There you can try to change the minimum range span. Currently there is a known issue - if the chart view is zoomed too much then the chart view will not draw values properly. That is why I had set the minimum range span in the first place.

    However, you can try it to see if it will work for your project. If this is not applicable then I would have to suggest that you you pass a new items source to to the chart view when the selected item has changed. This way no zooming will be applied at all.

    I am not familiar with your current requirements but may be a RadTimeBar will be a better fit for your project. You can examine the time bar's examples here.

    Regards,
    Petar Marchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top