Problem with zooming in Chart
Problem with zooming in Chart
I am running Delphi 7 Professional on Windows XP using TeeChart2010 Standard. I have set up a simple chart with two series. One on the left axis and one on the right axis. The scales of the axes are very different. When try to zoom using a rectangle from top left to bottom right, the left and right axes now both the same scale (actually the scale of the right axis). The series associated with the left axis does not show anymore as the values are much smaller than the right axis. See attached pictures for better explanation.
- Attachments
-
- Zoomed.png (16.34 KiB) Viewed 4886 times
-
- Zooming.png (16.75 KiB) Viewed 4882 times
-
- Unzoomed.png (17.2 KiB) Viewed 4880 times
Re: Problem with zooming in Chart
Hi Diarmid,
So in the pictures above, you'd like the left axis to bee set from 0.268 to 0.292 (aprox), isn't it? In that case I'm afraid you should do it manually. Here there are some tips you'll need:
- Zooming & Scrolling article
- Custom axes do not zoom. Any solutions? FAQ
If you still have problems with it, please don't hesitate to let us know.
So in the pictures above, you'd like the left axis to bee set from 0.268 to 0.292 (aprox), isn't it? In that case I'm afraid you should do it manually. Here there are some tips you'll need:
- Zooming & Scrolling article
- Custom axes do not zoom. Any solutions? FAQ
If you still have problems with it, please don't hesitate to let us know.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with zooming in Chart
Hi There,
I wanted the zoom to make the left axis go from 0.268 - 0.292 and the right axis to go from to zoom in 458.5 - 462.5. From what you are saying, using the rectangle will only change the right axis correctly. Is this behaviour repeatable? Will it always put things to the scale of the right axis or will it sometimes put it to the scale of the left axis?
I wanted the zoom to make the left axis go from 0.268 - 0.292 and the right axis to go from to zoom in 458.5 - 462.5. From what you are saying, using the rectangle will only change the right axis correctly. Is this behaviour repeatable? Will it always put things to the scale of the right axis or will it sometimes put it to the scale of the left axis?
Re: Problem with zooming in Chart
Hi Diarmid,
Take a look at the following example. It works as I understood you want to:
Take a look at the following example. It works as I understood you want to:
Code: Select all
uses series;
var fast1, fast2: TFastLineSeries;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
fast1:=Chart1.AddSeries(TFastLineSeries.Create(self)) as TFastLineSeries;
fast2:=Chart1.AddSeries(TFastLineSeries.Create(self)) as TFastLineSeries;
for i:=0 to 99 do
begin
fast1.Add(random*0.005 + 0.16);
fast2.Add(random*4 + 460);
end;
fast2.VertAxis:=aRightAxis;
fast2.Color:=clRed;
With Chart1.Axes.Left do
begin
SetMinMax(0.16,0.3);
Axis.Color:=fast1.Color;
MinorTicks.Color:=fast1.Color;
Ticks.Color:=fast1.Color;
LabelsFont.Color:=fast1.Color;
end;
with Chart1.Axes.Right do
begin
SetMinMax(440,464);
Axis.Color:=fast2.Color;
MinorTicks.Color:=fast2.Color;
Ticks.Color:=fast2.Color;
LabelsFont.Color:=fast2.Color;
end;
end;
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
With Chart1.Axes.Left do
SetMinMax(CalcPosPoint(Chart1.Zoom.Y1),CalcPosPoint(Chart1.Zoom.Y0));
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with zooming in Chart
I created a new project and inserted the computer code that you posted and I get the exact same result as previous. The scale of the left axis becomes the same as the scale of the right axis. That is not what I want...
Re: Problem with zooming in Chart
Hi Diarmid,
Have you created the OnZoom event?
Find attached a simple project.
Have you created the OnZoom event?
Find attached a simple project.
- Attachments
-
- zoomtest.zip
- (1.62 KiB) Downloaded 252 times
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with zooming in Chart
Right. Both your sample code and the sample program work. I need to get more sleep. Your help is very much appreciated.
Re: Problem with zooming in Chart
Hi Diarmid,
You're welcome!
You're welcome!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |