ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Reset zoom in chartdirector graphs
Posted by Rahul on Mar-04-2020 20:44
Hi,

I am using chartDirector in C# .net . I have graphs and included zoom-in and zoom-out functionality. Now in running graph, if person do zoom-in/zoom-out using mouse then is there any way to reset zoom including scroll bar position, length to the default one ?

  Re: Reset zoom in chartdirector graphs
Posted by Peter Kwan on Mar-05-2020 00:34
Hi Rahul,

From my understanding, you already have a chart that can zoom in and zoom out correctly. You would like to have some kind of user interface (such as a push button) that can immediately change the zoom level to "completely zoom out" (that is, all the data are visible).

To do this, you just need to set the ViewPortWidth to 1, and the ViewPortLeft to 0, and then call updateViewPort. The exact code depends on whether you are writing a desktop application (such as Windows Forms or WPF) or web application.

For example, in a desktop application, it may be like:

winChartViewer1.ViewPortWidth = 1;
winChartViewer1.ViewPortLeft = 0;
winChartViewer1.updateViewPort(true, false);

The sample code "XY Zooming and Scrolling (Windows)" is an example that uses an external control (a slider) to change the zoom level. See:

https://www.advsofteng.com/doc/cdnet.htm#xyzoomscroll.htm

For web applications, there is an example at:

https://www.advsofteng.com/doc/cdnet.htm#zoomscrolltrackweb.htm

Hope this can help.

Regards
Peter Kwan

  Re: Reset zoom in chartdirector graphs
Posted by Rahul on Mar-06-2020 14:09
Thanks Peter for help. I am using Desktop application and able to do zoom reset operations and changed the parameters to defaults one .