Board index » delphi » TeeChart Zoom

TeeChart Zoom

Just a {*word*218}...

Is there a way of returning the current zoom value on a TeeChart?  this is
for two reasons: 1) To display on screen and 2) To change the scrolling
behavior parameter.

Kindest regards

Matthew Augier
data product services
E-Mail : Matt...@DPS.uk.com
Web : http://www.DPS.uk.com

 

Re:TeeChart Zoom


Hi Matthew !
When a Chart is zoomed, the axis scales are changed.
That is, you can "zoom" the chart manually just by
changing the axes min and max:

Chart1.LeftAxis.SetMinMax( 1000,2000) ;
Chart1.BottomAxis.SetMinMax( 50,100 );

When Charts are zoomed, the "OnZoom" event is triggered.

Sorry. What does it means "returning the current zoom value"?

You can store the current axis Min and Max into a private
variables:

MyMin:=Chart1.BottomAxis.Minimum;
MyMax:=Chart1.BottomAxis.Maximum;

To then reset back:

Chart1.BottomAxis.SetMinMax( MyMin, MyMax );

Regards !
David Berneda
www.teemach.com

Quote
Matthew Augier (dps) wrote:

> Just a {*word*218}...

> Is there a way of returning the current zoom value on a TeeChart?  this is
> for two reasons: 1) To display on screen and 2) To change the scrolling
> behavior parameter.

> Kindest regards

> Matthew Augier
> data product services
> E-Mail : Matt...@DPS.uk.com
> Web : http://www.DPS.uk.com

Re:TeeChart Zoom


David

Quote
> Sorry. What does it means "returning the current zoom value"?

If the user selects an area to zoom in on, I would like to use the
OnAfterZoom to change a value on the status bar (e.g Zoom=100% to
Zoom=250%). From what you are saying I could store the original and then
calculate it I suppose, but why re-invent the wheel if that feature is
already there. While I'm on the subject, the zoom feature will distort the
graph depending on the way that the user selects an area, is it possible to
zoom on a non-distorted way, or again should I do this via programming ?

Kindest regards

Matthew Augier
data product services
E-Mail : Matt...@DPS.uk.com
Web : http://www.DPS.uk.com

P.S I think that the teeChart component is fantastic ! Well done !

Re:TeeChart Zoom


Hi Matthew !
Ok. I get what you need.
There is no "Zoom %" property, so you have to calculate it
by code 100*( ( TotalMax-TotalMin ) / (CurrentMax - CurrentMin ))

Also there's no "proportional" zooming. You can do this in the
OnZoom event, after calling Chart1.BottomAxis.AdjustMaxMin to
force the axis to recalculate the new "zoomed" min and max.

I'll post an example of proportional zooming at www.teemach.com
as soon I get time.
It should be something like this:

procedure TForm1.Chart1Zoom(Sender: TObject);
var tmpZoomedY,tmpCenterY,tmpRatio:Double;
begin
    With Series1 do
      tmpRatio:=(MaxXValue-MinXValue)/(MaxYValue-MinYValue);

    Chart1.BottomAxis.AdjustMaxMin;
    With Chart1.LeftAxis do
    begin
      AdjustMaxMin;
      tmpCenterY:=(Maximum+Minimum)/2.0;
      tmpZoomedY:=tmpRatio*(Series1.MaxYValue-Series1.MinYValue)/2.0;
      SetMinMax(tmpCenterY-tmpZoomedY, tmpCenterY+tmpZoomedY);
    end;
end;

Regards !
David Berneda
www.teemach.com

Quote
Matthew Augier (dps) wrote:

> David

> > Sorry. What does it means "returning the current zoom value"?

> If the user selects an area to zoom in on, I would like to use the
> OnAfterZoom to change a value on the status bar (e.g Zoom=100% to
> Zoom=250%). From what you are saying I could store the original and then
> calculate it I suppose, but why re-invent the wheel if that feature is
> already there. While I'm on the subject, the zoom feature will distort the
> graph depending on the way that the user selects an area, is it possible to
> zoom on a non-distorted way, or again should I do this via programming ?

> Kindest regards

> Matthew Augier
> data product services
> E-Mail : Matt...@DPS.uk.com
> Web : http://www.DPS.uk.com

> P.S I think that the teeChart component is fantastic ! Well done !

Re:TeeChart Zoom


David,

THANKS !

Kindest regards

Matthew Augier
data product services
E-Mail : Matt...@DPS.uk.com
Web : http://www.DPS.uk.com

Other Threads