How to construct a 'retracement' tool on a chart?
How to construct a 'retracement' tool on a chart?
I'd like to invoke the drawing tool and do the following:
Hold down the mouse and get the starting coordinates
Drag to another vertical point
Release the mouse and programmatically draw a series of horizontal trend lines between the 2 y values.
Is there an example showing this or something similar that I may examine? Is using the drawing tool the way to do this?
David
(Using V6 Tchart and VB6)
Hold down the mouse and get the starting coordinates
Drag to another vertical point
Release the mouse and programmatically draw a series of horizontal trend lines between the 2 y values.
Is there an example showing this or something similar that I may examine? Is using the drawing tool the way to do this?
David
(Using V6 Tchart and VB6)
Hi David,
do you mean something like this : ?
do you mean something like this : ?
Code: Select all
Dim MDown
Private Sub Form_Load()
MDown = False
With TChart1
.Aspect.View3D = False
.AddSeries scLine
.Zoom.Enable = False
.Axis.Left.SetMinMax 0, 10
.Axis.Bottom.SetMinMax 0, 10
End With
End Sub
Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
MDown = True
TChart1.Series(0).AddXY TChart1.Axis.Bottom.CalcPosPoint(X), TChart1.Axis.Left.CalcPosPoint(Y), "", clTeeColor
End Sub
Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If MDown = True Then
MDown = False
TChart1.Series(0).AddXY TChart1.Axis.Bottom.CalcPosPoint(X), TChart1.Axis.Left.CalcPosPoint(Y), "", clTeeColor
End If
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Thanks for the sample. I was trying to actually use the drawing tools instead of a series.
I'm captuing the point from the mouse down and mouse up activity so all I need to do is invoke the drawing tools
I'm having problem with an error on the 'addline' method.
The actual values are in another table. I just put in some constants to show you the problem. This should draw a horizontal line.
I get an error in the IDE on the addline statement that says "Compile error - expecting ="
It looks OK to me.
Using VB6 and version 6 of Tchart.
Thanks, David
I'm captuing the point from the mouse down and mouse up activity so all I need to do is invoke the drawing tools
I'm having problem with an error on the 'addline' method.
Code: Select all
With MultiChart.Tools.Items(0).asDrawLine
.EnableDraw = True
.AddLine(100,50,200,50)
End With
I get an error in the IDE on the addline statement that says "Compile error - expecting ="
It looks OK to me.
Using VB6 and version 6 of Tchart.
Thanks, David
Hi David,
could you please send me an example with which I can reproduce the problem "as is" here ? (please send it to the steema.public.attachments newsgroup or directly to my mail pep@steema.com).
could you please send me an example with which I can reproduce the problem "as is" here ? (please send it to the steema.public.attachments newsgroup or directly to my mail pep@steema.com).
Pep Jorge
http://support.steema.com
http://support.steema.com
Pep,
I'll send you an email because right now I just cant even enter the code I sent without getting an error in the IDE.
Maybe I'm doing something wrong altogether but it looks like I'm entering the proper values as indicated by the intellisense in VB 6
You'll see if you try to enter these lines.
Using V6.0.0.6
Thanks,
David
I'll send you an email because right now I just cant even enter the code I sent without getting an error in the IDE.
Code: Select all
Private Sub Command1_Click()
With TChart1.Tools.Items(0).asDrawLine
.EnableDraw = True
.AddLine(100,50,200,50)
End With
End Sub
You'll see if you try to enter these lines.
Using V6.0.0.6
Thanks,
David
Hi David,
yes please, send me it so I can reproduce it here. It works fine here using the following code :
yes please, send me it so I can reproduce it here. It works fine here using the following code :
Code: Select all
Private Sub Command1_Click()
With TChart1.Tools.Items(0).asDrawLine
.AddLine TChart1.Axis.Bottom.Minimum, TChart1.Axis.Left.Minimum, TChart1.Axis.Bottom.Maximum, TChart1.Axis.Left.Maximum
End With
End Sub
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scLine
.AddSeries scLine
.Series(0).FillSampleValues (10)
.Series(1).FillSampleValues (10)
.Tools.Add tcDrawLine
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Pep,
Your example helped. All I did was remove the parenthesis from the AddLine statement. In addition, I thought the coordinates that Addline wanted were the x,y points on the screen. I see from your example it wants the axis values.
Now that I'm past that next step, I can keep going.
One side benefit of me having this question was I finally downloaded V7 evaluation and got a chance to see some of the new stuff. I'll be upgrading soon!
Thanks,
David
Your example helped. All I did was remove the parenthesis from the AddLine statement. In addition, I thought the coordinates that Addline wanted were the x,y points on the screen. I see from your example it wants the axis values.
Now that I'm past that next step, I can keep going.
One side benefit of me having this question was I finally downloaded V7 evaluation and got a chance to see some of the new stuff. I'll be upgrading soon!
Thanks,
David