Nevron Forum

How to zoomIn or ZoomOut Chart programatically?

https://www.nevron.com/Forum/Topic6224.aspx

By Niranjan Singh - Tuesday, March 6, 2012

NChartCommander commander = new NChartCommander();
commander.ChartControl = nChartControl1;
commander.ZoomStep = 1;
commander.RotationStep = 1;
commander.ChartSizeStep = 1;


NZoomInCommand cmd = commander.Commands.GetCommandFromId((int)ChartCommand.ZoomIn) as NZoomInCommand;

How to Execute this Command. It is Enabled property is false always.
How NChartCommander and NChartCommand or NZoomInCommand interact to reflect the effect on the chart control.
By Nevron Support - Tuesday, March 6, 2012

Hi Niranjan,

In general the commands on the toolbar simply configure the chart - there is no need to create them or to execute them in order to achieve a particular configuration. For example in order to enable mouse zooming you need to execute:

nChartControl1.Controller.Tools.RemoveAllChildren();
nChartControl1.Controller.Tools.AddChild(
new NSelectorTool());
nChartControl1.Controller.Tools.AddChild(
new NOffsetTool());


similarly zoom is achived using:

nChartControl1.Controller.Tools.RemoveAllChildren();
nChartControl1.Controller.Tools.AddChild(
new NSelectorTool());
nChartControl1.Controller.Tools.AddChild(
new NZoomTool());

We would recommend to check out the examples located at All Examples\Interactivity\Tools regarding the usage of different chart tools.

By Niranjan Singh - Tuesday, March 6, 2012

Hi,
Thanks for your answer, but i am not using NChartCommandBarsManager class(UI component). I have my buttons and checed button on which i just need zoom in, zoom out, trackball and paning functionality.

Your documentation is not good to understand that how these classes interact with each other. In the first paragraph of written as:

"Commands are used to facilitate the implementation of any chart user action, which can be performed from a menu, toolbar or context menu."

Then How can we implement this using these commands, i have discovered much your classes about this but process of interaction of chart and these command is not clear.


Is these command directly implemented on chart or must add the toolbar with chart control.