Index

From: Christopher Ireland  Steema Software SL
Subject: Re: ColorLine
Date: Mon, 19 Aug 2002 09:33:09 +0200
Newsgroup: public.teechart5.wishes  

Hi Nathalie,

"Nathalie Beaudry" wrote in message
news:ClCtubWRCHA.968@teepc...

> Now the zoom: try drawing a rectangle with the left mouse button at the
left
> of the green ColorLine. The green ColorLine will appear outside of the
> graphic, just on the legend.

This can be solved with the use of IEnvironment.InternalRepaint. The code
below seems to perform well under the circumstances you have described so
far:

Private Sub Form_Load()
TeeCommander1.Chart = TChart1
With TChart1
.AddSeries scLine
.AddSeries scLine
.Series(0).FillSampleValues 20
.Series(1).FillSampleValues 20
.Tools.Add tcColorLine
.Tools.Add tcColorLine
.Tools.Items(0).asColorLine.Value = .Series(0).YValues.Minimum _
+ ((.Series(0).YValues.Maximum _
- .Series(0).YValues.Minimum) / 2)
.Tools.Items(1).asColorLine.Value = .Series(0).XValues.Minimum _
+ ((.Series(0).XValues.Maximum _
- .Series(0).XValues.Minimum) / 2)

.Tools.Items(0).asColorLine.Axis = .Axis.Left
.Tools.Items(1).asColorLine.Axis = .Axis.Bottom
.Tools.Items(0).asColorLine.Pen.Color = .Series(0).Color
.Tools.Items(1).asColorLine.Pen.Color = .Series(1).Color
.Tools.Items(0).Active = True
.Tools.Items(1).Active = True

.Tools.Items(0).asColorLine.NoLimitDrag = False
End With
End Sub


Private Sub TChart1_OnBeforeDrawSeries()
With TChart1
If .Axis.Left.CalcYPosValue(.Tools.Items(0).asColorLine.Value) <
..Axis.Top.Position Or
..Axis.Left.CalcYPosValue(.Tools.Items(0).asColorLine.Value) >
..Axis.Bottom.Position Then
.Tools.Items(0).Active = False
Else
.Tools.Items(0).Active = True
End If
If .Axis.Bottom.CalcXPosValue(.Tools.Items(1).asColorLine.Value) <
..Axis.Left.Position Or
..Axis.Bottom.CalcXPosValue(.Tools.Items(1).asColorLine.Value) >
..Axis.Right.Position Then
.Tools.Items(1).Active = False
Else
.Tools.Items(1).Active = True
End If
End With
End Sub

Private Sub TChart1_OnUndoZoom()
With TChart1
.Tools.Items(0).Active = True
.Tools.Items(1).Active = True
End With
End Sub

Private Sub TChart1_OnZoom()
With TChart1
.Environment.InternalRepaint
End With
End Sub

Best regards,

Christopher Ireland
Steema Software SL