Page 1 of 1

I Need Help in asColorLine Tool

Posted: Wed Jul 11, 2007 10:48 am
by 9526591
Hi
i add Many Lines as asColorLine Tool

The Problem is I need Now To Delete One of Them Exactly
(I do not now it's number) to Use

TChart1.Tools.Delete ColorLineNo

Can I Add a Name or Desc To Then Line To Know it ???
Thanks

Posted: Wed Jul 11, 2007 3:24 pm
by Pep
Hi,

the only way is by using the canvas techniques to draw name (text) next to each colorLine tool. It can be done with the following code :

Code: Select all

Private Sub TChart1_OnAfterDraw()
TChart1.Canvas.TextOut TChart1.Axis.Left.Position, TChart1.Axis.Left.CalcYPosValue(TChart1.Tools.Items(0).asColorLine.Value), "ColorLine0"
End Sub

Posted: Wed Jul 11, 2007 9:47 pm
by 9526591
i Think you don't understand my

i need to delete one of the asColorLine Tool , but the problem i don't now it's number.

thanks

Posted: Thu Jul 12, 2007 8:46 am
by Pep
Hi,

when you create the ColorLineTool you can save its index by using :

num = TChart1.Tools.Add(tcColorLine)
TChart1.Tools.Items(num).asColorLine.Axis = TChart1.Axis.Left
TChart1.Tools.Items(num).asColorLine.Value = X

and then remove it with :
TChart1.Tools.Delete (num)