Annotation Tool and relocation after zooming the chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JC
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: JHB
Contact:

Annotation Tool and relocation after zooming the chart

Post by JC » Tue Jan 11, 2005 11:25 am

I have an annotation placed in a very specific point basec on X Y values for a series. When the user zoom - the annotaion remains in the same location and is pointing to an invalid location.

I use use :

//
FSessionZoneNames.Shape.Left := DBChartSession.LeftAxis.PosAxis;
FSessionZoneNames.Shape.Top := SeriesHR.CalcYPosValue(FieldByName('high').AsInteger);

//
to get the orginal locations but after zooming the result is incorrect, Recreating after the zoom works but is not what is required.

Any ideas...

JC
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: JHB
Contact:

More of the same

Post by JC » Tue Jan 11, 2005 11:29 am

When resizing the form, the same happens - the annotation floats in teh middle on nowhere. is there no way to keep it relative to the correct location

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jan 11, 2005 11:52 am

Hi JC,

I have posted an example project trying to reproduce what you descrive. Is this the behaviour you get? If not could you please modify the project to reproduce what you are reporting?

The sample project is posted at steema.public.attachments newsgroups.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Jan 11, 2005 11:58 am

Hi.

The following code, placed in chart OnBeforeDrawSeries event should work fine:

Code: Select all

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
  With annotateTool1.Shape do
  begin
    CustomPosition := True;
    Left := Chart1.Axes.Left.PosAxis;
    Top := Chart1.Axes.Left.CalcYPosValue(your_y_value);
  end;
end;
Marjan Slatinek,
http://www.steema.com

JC
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: JHB
Contact:

Now i have a serious Exception

Post by JC » Tue Jan 11, 2005 12:33 pm

Putting the code in OnBeforeDrawSeries works but I am getting exceptions that killing the chart + app.I use wrapper routines to hide and shwo zone overlays as follows:

Code: Select all

procedure TViewAnalyzer.HideZoneOverlay;
var
  i : integer;
begin
  for i := 0 to 19 do
  begin
    if (FSessionZoneBands[i] <> nil) then
    begin
      DBChartSession.Tools.Remove(FSessionZoneBands[i]);    
      FSessionZoneBands[i].Free;
      FSessionZoneBands[i] := nil;
    end;
    if (FSessionZoneNames[i] <> nil) then
    begin
      DBChartSession.Tools.Remove(FSessionZoneNames[i]);    
      FSessionZoneNames[i].Free;
      FSessionZoneNames[i] := nil;
    end;      
  end;
end;
the line

Code: Select all

"FSessionZoneNames[i].Free;"
causes the exception.

Help is appreciated

Thanks

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Jan 12, 2005 9:08 am

Hi.

See my reply here
Marjan Slatinek,
http://www.steema.com

Post Reply