Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 666 - TChart does not work properly, when Zooming with ZoomPercent
Summary: TChart does not work properly, when Zooming with ZoomPercent
Status: RESOLVED NOTABUG
Alias: None
Product: FireMonkey TeeChart
Classification: Unclassified
Component: Chart (show other bugs)
Version: 140220
Hardware: All All
: Normal major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-25 08:19 EDT by Mustafa Celik
Modified: 2014-03-28 03:56 EDT (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mustafa Celik 2014-03-25 08:19:26 EDT
- I am using the TDBChart Component

- the user can change the zoom percentage over an TComboBox (1,15,25,50,100)%

- But after firing the ComboBox OnChange-Event the Chart gets zoomed out everytime, regardless of the double-value given to the procedure ZoomPercent(..)

The code i tried is:

-> fScale: double;
-> cbxScale has fix values (1,15,25,50,100)


procedure TForm1.cbxScaleChange(Sender: TObject);
begin
   fScale := (100/fScale) * StrToFloat(cbxScale.Selected.Text);
   TDBChart1.ZoomPercent(fScale);
end;
Comment 1 Mustafa Celik 2014-03-25 08:20:25 EDT
PS: The issues comes up on Win32 and on Android
Comment 2 david berneda 2014-03-27 13:11:51 EDT
I think this is not a bug. Its by design.
ZoomPercent applies a percentage zoom relative to the existing "zoom" (axis scales).

If you wish an absolute zoom, first reset the axes and then apply the zoom, like:

procedure TForm1.cbxScaleChange(Sender: TObject);
begin
   fScale := (100/fScale) * StrToFloat(cbxScale.Selected.Text);

   TDBChart1.Axes.Reset; // <-- Reset to 100%

   TDBChart1.ZoomPercent(fScale);
end;
Comment 3 Mustafa Celik 2014-03-28 03:33:24 EDT
(Bezüglich comment 2 von david berneda)
> I think this is not a bug. Its by design.
> ZoomPercent applies a percentage zoom relative to the existing "zoom" (axis
> scales).
> 
> If you wish an absolute zoom, first reset the axes and then apply the zoom,
> like:
> 
> procedure TForm1.cbxScaleChange(Sender: TObject);
> begin
>    fScale := (100/fScale) * StrToFloat(cbxScale.Selected.Text);
> 
>    TDBChart1.Axes.Reset; // <-- Reset to 100%
> 
>    TDBChart1.ZoomPercent(fScale);
> end;

Hello Mr. Berneda,
thank you for the fast response!
i tried to do it with TDBChart1.UndoZoom() before doing a ZoomPercent. But UndoZoom() has not been fired properly or is it not the correct procedure at this point?

I will try your solution. and give response. Thank you again!
Comment 4 Mustafa Celik 2014-03-28 03:56:49 EDT
Mr.Berneda,
the effect is the same as before. The existing zoom gets a percentage zoom again and again but not changing the axes back to 100%.

Code:

procedure TForm1.cbxScaleChange(Sender: TObject);
begin
   fScale := StrToFloat(cbxScale.Selected.Text);

   TDBChart1.Axes.Reset; // <-- Reset to 100%

   TDBChart1.ZoomPercent(fScale);
end;