Hi Plamen,
Our guess is that you want to achieve data panning - in this case it's better to use the build-in data pan tool, instead of forwarding the mouse input the axis scroll tool (which can have unpredictable results as the tool had to be in drag state in order to work). Try this code:
private void Form1_Load(object sender, EventArgs e)
{
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.Dock = DockStyle.Fill;
NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.UseXValues = true;
line.DataLabelStyle = new NDataLabelStyle();
NDateTimeAxisPagingView dateTimePagingView = new NDateTimeAxisPagingView(DateTime.Now.AddMonths(-1), new NDateTimeSpan(1, NDateTimeUnit.Month));
dateTimePagingView.Enabled = true;
NAxis axis = chart.Axis(StandardAxis.PrimaryX);
axis.PagingView = dateTimePagingView;
NValueTimelineScaleConfigurator timelineScale = new NValueTimelineScaleConfigurator();
axis.ScaleConfigurator = timelineScale;
axis.View = new NRangeAxisView(new NRange1DD(DateTime.Now.AddYears(-1).ToOADate(), DateTime.Now.ToOADate()));
axis.ScrollBar.Visible = true;
nChartControl1.Controller.Tools.Add(new NSelectorTool());
nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
NDataPanTool dataPanTool = new NDataPanTool();
dataPanTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Down, MouseButtons.Left, 1);
dataPanTool.EndDragMouseCommand = new NMouseCommand(MouseAction.Up, MouseButtons.Left, 1);
nChartControl1.Controller.Tools.Add(dataPanTool);
Random random = new Random();
for (DateTime dt = DateTime.Now; dt > DateTime.Now.AddYears(-1); dt = dt.AddDays(-1))
{
line.XValues.Add(dt);
line.Values.Add(random.Next(100));
}
}
Hope this helps - let us know if you have any questions or meet any problems.
Best Regards,
Nevron Support Team