Drawline tool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
seanmurphy
Newbie
Newbie
Posts: 48
Joined: Fri Mar 12, 2004 5:00 am

Drawline tool

Post by seanmurphy » Wed Jul 20, 2005 6:50 pm

I would like to add a drawline with marks on the line acting as a ruler. Is there a way to get at the ondraw event of a drawline tool and add a scale there?

thanks
Sean.

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

Post by Pep » Fri Jul 22, 2005 9:51 am

Hi Sean,

no, this cannot be done easily, but with hard code it could be simulated (using the Canvas techniques (TextOut) in OnAfterDraw event). using similar code like this :

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var i : integer;
begin
if Charttool1.Lines.Count > 0 then
for i := 0 to ChartTool1.Lines.Count -1 do
begin
  Chart1.Canvas.TextOut(Chart1.Axes.Bottom.CalcXPosValue(Round(ChartTool1.Lines.Line[i].X0)),
  Chart1.Axes.Left.CalcYPosValue(Round(ChartTool1.Lines.Line[i].Y0)),'0');
  Chart1.Canvas.TextOut(Chart1.Axes.Bottom.CalcXPosValue(Round(ChartTool1.Lines.Line[i].X1)),
  Chart1.Axes.Left.CalcYPosValue(Round(ChartTool1.Lines.Line[i].Y1)),'1');
end;
end;

Post Reply