Page 1 of 1
When is PosAxis updated?
Posted: Fri Jan 27, 2006 4:57 pm
by 9345036
Hello,
I would like to arrange some icons near a vertical axis. Because I move the axes I have to recalculate the relative positions of the icons to the axis. When I change TChart->MarginLeft and TChartAxis->PositionPercent, TChartAxis->PosAxis is not updated immediately. When is this value updated?
Posted: Mon Jan 30, 2006 9:49 am
by narcis
Hi to2,
You may force them being changed by re-drawing the chart using Chart1.Invalidate or Chart1.Refresh methods.
Posted: Mon Jan 30, 2006 4:37 pm
by 9345036
narcis wrote:You may force them being changed by re-drawing the chart using Chart1.Invalidate or Chart1.Refresh methods.
I set all units to pixels. LeftAxis is invisible.
Code: Select all
Chart1->MarginLeft = 35;
Chart1->LeftAxis->PositionPercent = 0;
IMO Chart1->LeftAxis->FPosAxis should be 35 now.
DebugInspector: Chart1->LeftAxis->FPosAxis=0
DebugInspector: Chart1->LeftAxis->FPosAxis=0
DebugInspector: Chart1->LeftAxis->FPosAxis=0
Next Time I run this code -> DebugInspector: Chart1->LeftAxis->FPosAxis=35
FPosAxis gets its 35 pixels but I don't know when. I can't force it by Invalidate(), Refresh(), Repaint(). What I want to prevent is a Application->ProcessMessages().
Posted: Wed Feb 08, 2006 8:45 am
by Pep
Hi,
to do this you should use the OnAfterDraw event, using similar code to the following all custom objects (like texts,..) are moved changing the margins.
Code: Select all
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Chart1.MarginLeft := 35;
Chart1.LeftAxis.positionPercent := 0;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Chart1.Canvas.TextOut(Chart1.LeftAxis.PosAxis,Chart1.BottomAxis.PosAxis,'hello world');
end;