Hi all,
I use a simple zoompercent(110) on a chart (data origin on left and bottom axis are 0). After zooming in, data origin is changed, as if axes where scrolled (after a few tests, it looks like if zoompercent(110) performed a zoomrect at the center of my graph).
I tried to scroll axes, but I cannot get the value of the first visible graduation (tick) on the left axis (on the screenshot it is 0,4)...
How can I adjust my graph to get back my origin to (0,0) ?
Any idea is welcome !
Zoompercent and graph scrolling
Zoompercent and graph scrolling
- Attachments
-
- original chart
- before.jpg (78.18 KiB) Viewed 5703 times
-
- after zooming in by 10%
- after.jpg (64.91 KiB) Viewed 5695 times
Re: Zoompercent and graph scrolling
Hi,
You could restore the default view setting the axes automatic property to true. For example:
You could restore the default view setting the axes automatic property to true. For example:
Code: Select all
procedure TForm1.ZoomInClick(Sender: TObject);
begin
Chart1.ZoomPercent(110);
end;
procedure TForm1.ZoomOutClick(Sender: TObject);
begin
Chart1.ZoomPercent(90);
end;
procedure TForm1.ZoomResetClick(Sender: TObject);
begin
Chart1.Axes.Bottom.Automatic:=true;
Chart1.Axes.Left.Automatic:=true;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Zoompercent and graph scrolling
Hi Yeray,
Thanks for your answer.
Unfortunately, this does not solve my problem. I probably did't explain myself clearly enough.
When I perform, the chart origin is changed from (0,0) to (0.4,10). I wanted to keep chart origin at (0,0).
Restoring the default view setting the axes automatic property to true () does not help, since it unzoom the graph.
Can you advise ?
Best regards,
Chesnetda
Thanks for your answer.
Unfortunately, this does not solve my problem. I probably did't explain myself clearly enough.
When I perform
Code: Select all
Chart1.ZoomPercent(110);
Restoring the default view setting the axes automatic property to true (
Code: Select all
Chart1.Axes.Bottom.Automatic:=true;
Can you advise ?
Best regards,
Chesnetda
Re: Zoompercent and graph scrolling
Hi,
If I'm not wrong, you are source code customer. As you'll see, the CalcAxisScale procedure, nested into TCustomChart.ZoomPercent, in Chart.pas does:
Changing it for this, I think it behaves as you want, applying the ZoomPercent to the left&bottom axes maximum, not to the minimum.
If I'm not wrong, you are source code customer. As you'll see, the CalcAxisScale procedure, nested into TCustomChart.ZoomPercent, in Chart.pas does:
Code: Select all
if ApplyZoom then
begin
tmpDelta:=(AMax-AMin)*(PercentZoom-100.0)*0.01;
tmpA:=AMin+tmpDelta;
tmpB:=AMax-tmpDelta;
end
Code: Select all
if ApplyZoom then
begin
tmpDelta:=(AMax-AMin)*(PercentZoom-100.0)*0.01;
tmpA:=AMin;
tmpB:=AMax-tmpDelta*2;
end
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Zoompercent and graph scrolling
Hello Yeray,
That's an elegant solution !
You're right, I should be diving into TeeChart source code more often...
Thanks a lot for your help !
All the Best,
DAvid
That's an elegant solution !
You're right, I should be diving into TeeChart source code more often...
Thanks a lot for your help !
All the Best,
DAvid
Re: Zoompercent and graph scrolling
Hi David,
You're welcome! I'm glad to see you're satisfied with it.
You're welcome! I'm glad to see you're satisfied with it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |