just after completing the a graph by setting the different values of a TBar3DSeries i want to draw a horizontal line as follows.
MyTeeChart->Canvas->MoveTo(0,MyTeeChart->LeftAxis->CalcYPosValue(0));
MyTeeChart->Canvas->LineTo(500,MyTeeChart->LeftAxis->CalcYPosValue(0));
unfortunately, the line dissapears immediately after a few milliseconds. does anybody know why ????
when placing the lines into an event like OnBeforeDrawSeries or OnAfterDraw the line stays but i can't use them for the following reasons:
beforedraw: at this point i do not yet know the position of the YPosValue(0) so i need to know after the series is complete
afterdraw: i would like to have the line behind the seriesbars, so afterdraw would be too late
thanks for some hints
uwe
custom drawing disappears after a few milliseconds
-
- Newbie
- Posts: 4
- Joined: Tue Aug 04, 2009 12:00 am
- Contact:
Re: custom drawing disappears after a few milliseconds
Hi uwe,
OnBeforeDrawSeries seems to work fine for me here. Could you please try the following example and see if it works as you wish?
OnBeforeDrawSeries seems to work fine for me here. Could you please try the following example and see if it works as you wish?
Code: Select all
var bar1: TBar3DSeries;
procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
with Chart1.Canvas do
begin
Pen.Color := clRed;
MoveTo(Chart1.Axes.Bottom.IStartPos,Chart1.Axes.Left.CalcYPosValue(0));
LineTo(Chart1.Axes.Bottom.IEndPos,Chart1.Axes.Left.CalcYPosValue(0));
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bar1 := TBar3DSeries.create(self);
Chart1.AddSeries(bar1);
bar1.AddBar(0, 50, -10);
bar1.AddBar(1, -50, 20);
bar1.AddBar(2, 70, -5);
bar1.AddBar(3, 10, 0);
bar1.AddBar(4, -20, 0);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 4
- Joined: Tue Aug 04, 2009 12:00 am
- Contact:
Re: custom drawing disappears after a few milliseconds
i tried your example and also applied it to my own application. everything works fine now !!!
thanks a lot
uwe
thanks a lot
uwe