From Steema Software Reference Wiki
Revision as of 12:01, 29 April 2016 by Clive (Talk | contribs) (Scroll)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tchart php.png

Contents page
Previous | Next

Tutorial 8 - Zoom and Scroll

How to Zoom and Scroll by code


See the Zoom Class for a full list of methods associated with Zoom. To define a rectangular area over which to Zoom use the ZoomRect method.


$tChart1->getZoom()->zoomRect(new Rectangle(100,100,120,120));

The ZoomRect co-ordinates are defined in screen pixels where 0,0 is the top left hand point of the Chart Panel. The following code will zoom in on an area between the 2nd and 5th x-axis points, setting the y-axis to the scale of the maximum and minimum points of the entire Chart:

$x = $points1->calcXPos(2); 
$y = $tChart1->getAxes()->getLeft()->calcYPosValue($tChart1->getAxes()->getLeft()->getMaxYValue()); 
$height = $tChart1->getAxes()->getLeft()->calcYPosValue($tChart1->getAxes()->getLeft()->getMinYValue()) - 
$width = $points1->calcXPos(5) - $x; 
$r = new Rectangle($x,$y,$width,$height); 

Use 'Undo' to Zoom back out.


Zoom events

For the moment there aren't available events for zoom and scroll at runtime.


Scroll is enabled in all directions as default. Use the Scroll->Allow property to disable Scroll or limit Scroll to one direction.
The easiest way to scroll by code is to use the Axis Scroll method:


$tChart2->getAxes()->getBottom()->scroll(3, false);

The value is the offset. 'False' refers to whether or not TeeChart will allow scrolling beyond Series value limits.

Another way to control scroll is to define Axis maximum and minumum to scroll by code:


private function Load() {
$range = round(($bar1->getXValues()->getMaximum() - $bar1->getXValues()->getMinimum() / 2)); 
$jScrollBar1->setMinimum($range - 50); 
$jScrollBar1->setMaximum($range   50); 
public funcion ScrollBar1_propertyChange() { $tChart1->getAxes()->getBottom()->setAutomatic(false); $tChart1->getAxes()->getBottom()->setMinimum($jScrollBar1->getValue()); $tChart1->getAxes()->getBottom()->setMaximum($jScrollBar1->getValue() $bar1->getCount()); }



© 1998-2020 Steema Software SL. All rights reserved.