Restrict dragging along vertical axis

Jun 13, 2012 at 8:16 PM
Edited Jun 18, 2012 at 5:39 PM

Hi all,

I currently am manually setting the chart range using Viewport.Visible attribute. However, I would also like to only allow user to drag the graph along the horizontal axis and not the vertical axis, primarily because the vertical axis values are restricted to a certain bound, so there's really no reason to allow users to drag the graph vertically.

On a side note, when I try scrolling up in the graph, the graph essentially freezes and I have no idea why. Any clues?



Edit: Also scrolling down doesn't seem to zoom out. It instead scroll down along both vertical and horizontal axis. Am I missing something to use the zooming property correctly?

Edit2: Actually the scrolling to zoom functionality seems to be broken altogether in the WPF version.

Oct 8, 2013 at 8:21 AM
To achieve that funcionality I copied MouseNavigation class, named it MyMouseNavigation and modified this code:
private void OnMouseMove( object sender, MouseEventArgs e )
    Point loc = Viewport.Visible.Location;
    Vector shift = panningStartPointInViewport - endPoint;
    shift.Y = 0; // this is the line which I've added to remove vertical panning
    loc += shift;
Then you have to remove original MouseNavigation which is in use:
    plotter.Children.Remove( plotter.MouseNavigation );
The last thing you need to do is use our custom mouse navigation:
    plotter.Children.Add( new MyMouseNavigation() );
I hope it will help you :).