Page 1 of 1

Zooming with Multiple Y axes in TChart 2010

Posted: Thu Aug 12, 2010 7:34 pm
by 16556585
I have a problem with T-Chart 2010 on zooming with multiple Y axes. When I zoom, it zooms all the waveforms to a common y-axis. I loose the various scalings on the independent axes. I can turn off vertical zooming and the horizontal zooming works correctly for my single x-axis, but I would like to be able to zoom the same way I could with the RAD Studio 2007 version of the TChart component. Is there a setting to enable this? As I am upgrading to 2010, I have had to copy and pastes the charts in my applications to get the projects to compile without errors. Has this copy and paste changed the default zoom settings. It did add a gradient to my panel backgrounds that I had to remove. Is there a bug here?

Thanks for your help!

Re: Zooming with Multiple Y axes in TChart 2010

Posted: Fri Aug 13, 2010 1:36 pm
by yeray
Hi JMX Services,
JMX Services wrote:I have a problem with T-Chart 2010 on zooming with multiple Y axes. When I zoom, it zooms all the waveforms to a common y-axis. I loose the various scalings on the independent axes. I can turn off vertical zooming and the horizontal zooming works correctly for my single x-axis, but I would like to be able to zoom the same way I could with the RAD Studio 2007 version of the TChart component. Is there a setting to enable this?
The zoom for Custom axis has to be done manually calling SetMinMax routine at OnZoom and UndoZoom as explainmed in this FAQ.
Here it is an example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;

  for i:=0 to 3 do
  begin
    Chart1.AddSeries(TFastLineSeries);
    Chart1[i].FillSampleValues();
    Chart1.CustomAxes.Add;
    Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i];
  end;
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.CustomAxes.Count-1 do
    with Chart1.CustomAxes[i] do Automatic:=true;
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.CustomAxes.Count-1 do
    with Chart1.CustomAxes[i] do SetMinMax(CalcPosPoint(Chart1.Zoom.Y1),CalcPosPoint(Chart1.Zoom.Y0));
end;
JMX Services wrote:As I am upgrading to 2010, I have had to copy and pastes the charts in my applications to get the projects to compile without errors.
You could simply open your RAD 2007 projects in RAD 2010, can't you? This way the neither the code or the forms should be changed.
JMX Services wrote:Has this copy and paste changed the default zoom settings. It did add a gradient to my panel backgrounds that I had to remove. Is there a bug here?
Dropping a chart into a form, it adds a chart with a gradient in the panel since TeeChart VCL 2010. That was made to improve the appearance of the initial charts. A similar improvement was made in TeeChart v8 when the initial palette passed to be the OperaPalette.
I doesn't affect project upgrades from previous versions as this info is stored in the dfm.