Page 1 of 1

Move ColorLine to middle of graph after zooming

Posted: Tue Dec 02, 2008 1:46 pm
by 13050339
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.

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

Posted: Wed Dec 03, 2008 10:14 am
by 13050339
Thanks Narcis,

It is better for us.

Thanks again for your warm support.
My best regards.

Posted: Wed Dec 03, 2008 10:20 am
by narcis
Haianh,

You're very welcome. I'm glad to hear that helped.