Page 1 of 1

How to use TCanvas3D object to paint marks(point,line...)

Posted: Fri Nov 14, 2008 5:58 am
by 8574101
How to use TCanvas3D object to paint marks(point,line...) at any position
of Chart? For Example,I want to paint a line from P0(0,0) to P1(10,50).

TCanvas3D * cTest;
cTest = Chart1->Canvas;
.......


Regards
wwp3321

Posted: Fri Nov 14, 2008 8:55 am
by narcis
Hi wwp3321,

This is much easier, you can do something like this in the OnAfterDraw event:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var X0, Y0, X1, Y1: Integer;
begin
  X0:=Chart1.Axes.Bottom.CalcXPosValue(0);
  Y0:=Chart1.Axes.Left.CalcYPosValue(0);
  X1:=Chart1.Axes.Bottom.CalcXPosValue(10);
  Y1:=Chart1.Axes.Left.CalcYPosValue(50);
  Chart1.Canvas.Pen.Color:=clRed;
  Chart1.Canvas.Pen.Width:=3;
  Chart1.Canvas.Line(X0,Y0,X1,Y1);
end;

Posted: Fri Nov 14, 2008 11:25 am
by 8574101
Thank you ! :D