Hi Cho,
Yes you can disable vertical zooming using:
rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
similarly for the x axis:
rangeSelection.HorizontalValueSnapper = new NAxisRulerMinMaxSnapper();
so the code becomes:
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
NRangeSelection rangeSelection = new NRangeSelection();
rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
chart.RangeSelections.Add(rangeSelection);
NLineSeries line = new NLineSeries();
chart.Series.Add(line);
Random rand = new Random();
line.UseXValues = true;
line.DataLabelStyle.Visible = false;
for (int i = 0; i < 40; i++)
{
line.Values.Add(rand.Next(100));
line.XValues.Add(i);
}
chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(0, 100), true, true);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
NDataZoomTool dataZoomTool = new NDataZoomTool();
dataZoomTool.WheelZoomAtMouse = true;
dataZoomTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.None, 0);
nChartControl1.Controller.Tools.Add(dataZoomTool);
nChartControl1.Controller.Selection.Add(chart);
There is no way to have two data zoom tools that zoom differently - you need to switch between a configuration that has range selection that zooms only horizontally or vice versa. Let us know if you have any questions.
Best Regards,
Nevron Support Team