Profile Picture

Data zoom with mouse wheel does not work.

Posted By cho seongho 5 Years Ago
Author
Message
cho seongho
Problem Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 15, Visits: 73

I checked the "Wheel Zoom" check box in the "Data Zoom Tool" of the sample provided by your company and tried to operate the mouse wheel but it does not work. And I applied the following code to my source code, but it also does not work.


NDataTool dataZoomTool = new NDataZoomTool();
dataZoomTool.WheelZoomAtMouse = true;
dataZoomTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 0);
nChartControl1.Controller.Tools.Add(dataZoomTool);




Nevron Support
Posted 5 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Cho,
In order to have the wheel zoom feature working you need to have a range selection object and selected chart - for example:
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
    chart.RangeSelections.Add(new NRangeSelection());

    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);
Now when you press the Ctrl button + the mouse wheel you'll be able to zoom in / out at the current mouse position.
Hope this helps - let us know if you have any questions or meet any problems.

Best Regards,
Nevron Support Team



cho seongho
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 15, Visits: 73
Thank you for answer.
I have confirmed that it works well by applying the answer.
In addition, can I zoom in / out for each axis using the mouse wheel?

For example
<shift + wheel>: Only the X axis is Zoom
<ctrl + wheel>: Only the Y axis is Zoom

Please answer this question.

Nevron Support
Posted 5 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
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





Similar Topics


Reading This Topic