Common Question 29
How do I programmatically zoom a chart?
Zooming Horizontally with Graph
The Graph is zoomed horizontally by setting the PointsToGraph property and then setting the HorzScrollPos property to control the first point on the left. For more information on this subject, see Question 20 in this chapter.
Zooming Horizontally with Scientific Graph
The Scientific Graph can be zoomed horizontally as long as AllowZooming is set to PEAZ_HORIZONTAL (1). To accomplish the zoom, you set ZoomMinX and ZoomMaxX to the desired extents, and then set ZoomMode = TRUE. You do this in the course of your normal initialization code. If you also want AllowZooming set to both horizontal and vertical zooming, then you can temporarily set AllowZooming to PEAZ_HORIZONTAL, initialize the object with PEreinitialize and PEresetimage, (OCX/VCL developers use PEactions = 0) and then set AllowZooming to PEAZ_HORZANDVERT (3).
See example 124 in our demo or demo projects.
Zooming Vertically with the Graph and Scientific Graph.
ZoomMinY, ZoomMaxY, ZoomMinRY, and ZoomMaxRY are provided and can be used along with setting ZoomMode to TRUE in a simple chart which does not use MultiAxesSubsets. If multiple axes are being implemented, you will need to use the manual extent properties as described in Question 25 of this chapter. Note that we do not recommend manually configuring y axes in a multiple y axis implementation.
©2017 Gigasoft, Inc. | All rights reserved.
Gigasoft is a registered trademark, and ProEssentials a trademark of Gigasoft, Inc.