Profile Picture

Zooming charts by middle mouse wheel doesn't work

Posted By Fan-Jiang Zeng 9 Years Ago
Author
Message
Fan-Jiang Zeng
Problem Posted 9 Years Ago
View Quick Profile
 
Group: Forum Members
Last Active: 8 Years Ago
Posts: 7, Visits: 17
I wanted to use NZoomTool to zoom a chart by scrolling the mouse middle wheel, this is the code snippet:

var zoomTool = new NZoomTool();
zoomTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButtons.Middle, 1);
nChartControl.Controller.Tools.Add(_zoomTool);

The result is that it doesn't work at all, the chart cannot be zoomed when I scrolled the middle mouse wheel. Can anyone know if I did something wrong? Thank you!

Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Fan Jiang,

We just tested the control and it was zooming OK with the wheel:

nChartControl1.Charts[0].Enable3D = true;
NZoomTool zoomTool = new NZoomTool();
zoomTool.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 1);
nChartControl1.Controller.Selection.SelectedObjects.Add(nChartControl1.Charts[0]);
nChartControl1.Controller.Tools.Add(zoomTool);

Most likely you don't have a currently selected chart. In order to have one either place a panel selector tool (in which case the control will automatically select the chart under the mouse when you click on it) or use manual selection like in the example above.



Best Regards,
Nevron Support Team



Fan-Jiang Zeng
Posted 9 Years Ago
View Quick Profile
 
Group: Forum Members
Last Active: 8 Years Ago
Posts: 7, Visits: 17
Thank you for your patience. I'm sure I have added the current chart to the selected objects, but I still can't get the chart zoomed in/out by scrolling the middle wheel. I use the left button to rotate the chart, the right button the move the chart (offset tool), and the wheel the zoom the chart. I doubted the problem is caused by too many tools related to the mouse actions, so I removed the other 2 tools and left the zoom tool only, still, it DOESN'T work Sad
Currently I need a back-up plan. I want to control the zooming by 2 buttons - one zoom in button and one zoom out button, just as the ones in the toolbar created by dragging a NChartCommandBarsManager component to the GUI desing window. I have searched the whole Nevron docs and didn't find a related example yet. Then I tried NChartCommander class, but I DON'T know how to use it in my code, and I don't even know if it's the right choice.
Can you give me a simple example of directly zooming the chart by coding with other classes, but WITHOUT NZoomTool class? Thank you again!

Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi,

Is the chart in 2D - in this case we don't support zooming (you can still use the data zoom tool). For 3D charts you can touch the chart.Projection.Zoom property which is specified in percents:

chart.Projection.Zoom = 200.0f;

For data zooming you need to use the paging view - for example:

xAxis.PagingView.ZoomIn(new NRange1DD(0, 10), 0);

Hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team



Fan-Jiang Zeng
Posted 9 Years Ago
View Quick Profile
 
Group: Forum Members
Last Active: 8 Years Ago
Posts: 7, Visits: 17
Finally this worked!!! Thank you very much!!!!!



Similar Topics


Reading This Topic