When is PosAxis updated?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
to2
Newbie
Newbie
Posts: 39
Joined: Thu Jan 19, 2006 12:00 am

When is PosAxis updated?

Post by to2 » Fri Jan 27, 2006 4:57 pm

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?

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

Post by Narcís » Mon Jan 30, 2006 9:49 am

Hi to2,

You may force them being changed by re-drawing the chart using Chart1.Invalidate or Chart1.Refresh methods.
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

to2
Newbie
Newbie
Posts: 39
Joined: Thu Jan 19, 2006 12:00 am

Post by to2 » Mon Jan 30, 2006 4:37 pm

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

Code: Select all

Chart1->LeftAxis->Visible = true;
DebugInspector: Chart1->LeftAxis->FPosAxis=0

Code: Select all

Chart1->Refresh();
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().

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Feb 08, 2006 8:45 am

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;

Post Reply