Special-Zoom with Custom Axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Woehr.Mi
Newbie
Newbie
Posts: 38
Joined: Mon Jun 23, 2008 12:00 am

Special-Zoom with Custom Axis

Post by Woehr.Mi » Mon Aug 18, 2008 12:07 pm

Hello,

I have up to 8 Custom Axis on the left side in my TeeChart:

Custom Axis 1 | . . . . . . . . .
Custom Axis 2 | . . . . . . . . . . .
Custom Axis 3 |__________________
.. ... BottonAxis (Time)
and so on...


And I have to handle the Zoom-Feature of the Chart in a way, that only the CustomAxis which are in the Zoom-Rectangle are visible to get a better division of my different Series (that I have no area which is empty). But at the moment I have no idea how the get the information which Custom-Axis (Index of the CustomAxis) are in the Zoom-Rectangle. javascript:emoticon(':?:')
Question

Thanks for your answers
Michael

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Aug 19, 2008 11:55 am

Hi Michael,

If we understand well what you are trying to do, the following code could be a good example of how you could achieve it with two series (one vertical custom axis). We will hide everything out from the pointer when the mouse is unpressed. And we restore the "default view" when unzoom.

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  StartX := X;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i, j: Integer;
begin
  Caption := 'Y: ' + IntToStr(Y);

  if (StartX < X) then
  begin
    for i := 0 to Chart1.Axes.Count -1 do
      if not ((chart1.Axes.Items[i].Horizontal) or (chart1.Axes.Items[i].IsDepthAxis)) and not (Chart1.Axes.Items[i].OtherSide) then
        if (y > Chart1.Axes.Items[i].IStartPos) and (y < Chart1.Axes.Items[i].IEndPos) then
        begin
          chart1.Axes.Items[i].StartPosition :=0;
          Chart1.Axes.Items[i].EndPosition := 100;

          for j := 0 to Chart1.Axes.Count -1 do
            if not ((chart1.Axes.Items[i].Horizontal) or (chart1.Axes.Items[i].IsDepthAxis)) then
              chart1.Axes.Items[j].Visible := false;

          chart1.Axes.Items[i].Visible := true;
        end;
  end
  else
  begin
    for i := 0 to Chart1.Axes.Count -1 do
    begin
      if not ((chart1.Axes.Items[i].Horizontal) or (chart1.Axes.Items[i].IsDepthAxis)) and not (Chart1.Axes.Items[i].OtherSide) then
        chart1.Axes.Items[i].Visible := true;
    end;

    chart1.Axes.Items[2].StartPosition := 0;
    chart1.Axes.Items[2].EndPosition := 50;
    chart1.Axes.Items[6].StartPosition := 50;
    chart1.Axes.Items[6].EndPosition := 100;
  end;

  for i := 0 to Chart1.SeriesCount - 1 do
    Chart1[i].Visible := Chart1[i].GetVertAxis.Visible;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply