Page 1 of 1

Drawline tool

Posted: Wed Jul 20, 2005 6:50 pm
by 9231397
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.

Posted: Fri Jul 22, 2005 9:51 am
by Pep
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;