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?
When is PosAxis updated?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi to2,
You may force them being changed by re-drawing the chart using Chart1.Invalidate or Chart1.Refresh methods.
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 |
Instructions - How to post in this forum |
I set all units to pixels. LeftAxis is invisible.narcis wrote:You may force them being changed by re-drawing the chart using Chart1.Invalidate or Chart1.Refresh methods.
Code: Select all
Chart1->MarginLeft = 35;
Chart1->LeftAxis->PositionPercent = 0;
DebugInspector: Chart1->LeftAxis->FPosAxis=0
Code: Select all
Chart1->LeftAxis->Visible = true;
Code: Select all
Chart1->Refresh();
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().
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.
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;
Pep Jorge
http://support.steema.com
http://support.steema.com