Problem with panning

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
AnjaliIyengar
Posts: 6
Joined: Tue Jul 24, 2018 6:21 am

Problem with panning

Post by AnjaliIyengar » Wed Aug 01, 2018 1:45 pm

I'm a newbie to programming, so forgive me if the question is silly. :oops:

I have graph which I zoom(using mouse wheels) and pan(using left mouse). I want to stop the panning, if it goes bellow 0 on time scale(X-axis).
I used "PannedXYEventArgs" and "BeforePanningXYEventArgs event. That stopped the panning bellow 0.

But it is zooming instead when I pan near zero(I expect it to not pan). It is supposed to "only pan" with left mouse button. What am i missing?

ArctionNitin
Posts: 3
Joined: Fri Aug 03, 2018 1:18 pm

Re: Problem with panning

Post by ArctionNitin » Fri Aug 03, 2018 2:36 pm

Hi Anjali,

Yes, ideally it should Pan only and not zoom if you have set ViewXY.ZoomPanOptions.LeftMouseButtonAction = MouseButtonAction.Pan;
So, in your case it might me more than that :)

I tried to replicate your problem like below and it was working fine for me:
public partial class MainWindow : Window
{
private LightningChartUltimate _lcu;

public MainWindow()
{
InitializeComponent();
}

private void OnLoaded(object sender, RoutedEventArgs e)
{
_lcu = new LightningChartUltimate();
MainGrid.Children.Add(_lcu);
_lcu.ViewXY.ZoomPanOptions.LeftMouseButtonAction = MouseButtonAction.Pan;
_lcu.ViewXY.BeforePanning += ViewXY_BeforePanning;
}

private void ViewXY_BeforePanning(object sender, Arction.Wpf.Charting.Views.ViewXY.BeforePanningXYEventArgs e)
{
if(e.XRanges.First().NewMin < 0)
{
e.Cancel = true;
}
}
}


If you are doing something else or more, please update above code or you can send your code in a small project to me at [email protected]


Thanks,
Nitin Shrivastava

Post Reply