Drawlines Collection

TeeChart for ActiveX, COM and ASP
Post Reply
Rossmc
Newbie
Newbie
Posts: 23
Joined: Thu Mar 30, 2006 12:00 am

Drawlines Collection

Post by Rossmc » Tue May 23, 2006 7:13 am

Hi

Using v7 activex control in a financial charting application. I use the Drawlines tool to enable users to create trendlines. I need to know how I can directly work with the Drawlines collection if possible so that I can:
1) Persist trendlines (ie. if user reloads a previous chart that had trendlines, automatically redraw them where they were)
2) Have interactivity on a mouse over event (tooltip popup with point value for example, as well as right-click menu)

Those are just two possiblilities. If I could directly access the drawlines collection I am sure I could add further functionality.

Thanks once again.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue May 23, 2006 8:08 am

Hi Rossmc,

If you export a chart, containing a draw lines tool, to a native file and load it, the lines will be loaded as well.

To have interactivity you can do something as the code below. You can also access to the draw lines collection by using TChart2.Tools.Items(0).asDrawLine.Lines.Items array.

Code: Select all

Dim tmpX, tmpY As Integer

Private Sub Command1_Click()
    TChart1.Export.asNative.SaveToFile "e:\temp\tool.tee", True
End Sub

Private Sub Command2_Click()
    TChart2.ClearChart
End Sub

Private Sub Command3_Click()
    TChart2.Import.LoadFromFile "e:\temp\tool.tee"
End Sub

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 10
End Sub

Private Sub TChart2_OnDrawLineToolSelecting(ByVal Index As Long, ByVal AllowSelect As Boolean)
    Dim XVal, YVal As Double
    
    XVal = TChart2.Axis.Bottom.CalcPosPoint(tmpX)
    YVal = TChart2.Axis.Left.CalcPosPoint(tmpY)
    
    TChart2.Header.Text.Clear
    TChart2.Header.Text.Add CStr(XVal) & " - " & CStr(YVal)
End Sub

Private Sub TChart2_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    tmpX = X
    tmpY = Y
End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply