Page 1 of 1
Annotation Tool and relocation after zooming the chart
Posted: Tue Jan 11, 2005 11:25 am
by 8441042
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...
More of the same
Posted: Tue Jan 11, 2005 11:29 am
by 8441042
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
Posted: Tue Jan 11, 2005 11:52 am
by narcis
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.
Posted: Tue Jan 11, 2005 11:58 am
by Marjan
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;
Now i have a serious Exception
Posted: Tue Jan 11, 2005 12:33 pm
by 8441042
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
causes the exception.
Help is appreciated
Thanks
Posted: Wed Jan 12, 2005 9:08 am
by Marjan