By Fan-Jiang Zeng - Wednesday, July 8, 2015
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!
|
By Nevron Support - Thursday, July 9, 2015
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.
|
By Fan-Jiang Zeng - Monday, July 13, 2015
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  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!
|
By Nevron Support - Tuesday, July 14, 2015
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.
|
By Fan-Jiang Zeng - Wednesday, July 15, 2015
Finally this worked!!! Thank you very much!!!!!
|
|