Move ColorLine to middle of graph after zooming

TeeChart for ActiveX, COM and ASP
Post Reply
Haianh
Newbie
Newbie
Posts: 11
Joined: Wed Sep 17, 2008 12:00 am

Move ColorLine to middle of graph after zooming

Post by Haianh » Tue Dec 02, 2008 1:46 pm

Hi Steema,

I want to move a colorline to middle of graph after zooming.
Currently,I use event OnMouseDown to get previous bottom XValue, and OnMouseUp to get current bottom XValue.
After zooming, i move colorline by setting colorline.value = (PreviousX+CurrentX)/2
But it was not good . Sometimes, the colorline is not at center of graph, sometime it was disappeared of graph.
Please give us your advice in this case. How to do this in better way?
I use TeeChart ActiveX 7J.

Thanks and best regards.

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 Dec 02, 2008 4:54 pm

Hi Haianh,

You can do something like this:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scPoint
    
    TChart1.Series(0).FillSampleValues 10
    
    TChart1.Tools.Add tcColorLine
    TChart1.Tools.Items(0).asColorLine.Axis = TChart1.Axis.Left
End Sub

Private Sub TChart1_OnZoom()
    With TChart1.Axis.Left
        TChart1.Tools.Items(0).asColorLine.Value = .Minimum + (.Maximum - .Minimum) / 2
    End With
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

Haianh
Newbie
Newbie
Posts: 11
Joined: Wed Sep 17, 2008 12:00 am

Post by Haianh » Wed Dec 03, 2008 10:14 am

Thanks Narcis,

It is better for us.

Thanks again for your warm support.
My best regards.

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

Post by Narcís » Wed Dec 03, 2008 10:20 am

Haianh,

You're very welcome. I'm glad to hear that helped.
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