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

Message ListMessage List     Post MessagePost Message

  x & y zooming question
Posted by at on Oct-11-2012 12:26
Hi Peter, in the latest version, the implementation of zooming is somehow different such
that it is now using addEventListener and is a cleaner approach but I could not find an
example using that new implementation where you can zoom only the x axis or y axis
alone. Pls provide if there is.

Thanks.

  Re: x & y zooming question
Posted by Peter Kwan on Oct-12-2012 00:55
Hi at,

I think the "Simple Zooming and Scrolling" and the "Zoom and Scrolling with Track Line" sample code are both zooming only horizontally (zoom only the x-axis).

Basically, you can use JsChartViewer.setScrollDirection and JsChartViewer.setZoomDirection to select whether to scroll/zoom vertically or horizontally or both. If you do not call these methods, the default is to zoom/scroll horizontally only.

In the "XY Zooming and Scrolling" sample code, the chart can scroll/zoom both vertically and horizontally. It is because of the code:

    viewer.setScrollDirection(JsChartViewer.HorizontalVertical);
    viewer.setZoomDirection(JsChartViewer.HorizontalVertical);

If you want the user to be able to select which direction to zoom, you would need to have a user interface. The interface can be some radio buttons or push buttons or links and any method you would like to use. When the user clicks on the user interface, your click handler can call viewer.setScrollDirection and viewer.setZoomDirection to set the zoom/scroll direction.

In the charting code, you would need to handle both vertically and horizontally zooming. For example, in the "XY Zooming and Scrolling" sample code, it is like:

    $viewer->syncLinearAxisWithViewPort("x", $c->xAxis);
    $viewer->syncLinearAxisWithViewPort("y", $c->yAxis);

Hope this can help.

Regards
Peter Kwan