Hi,
I am using Guage series. After diplaying a value by using:
m_Chart.Series(m_lSeriesId).AddXY(...) I see the hand in a specific correct postion pointing to value.
I would like to get the pixels coordinates of the end point of the hand.
How can I get it?
Thanks,
yvb
Getting hand pixels values using gauge series
Re: Getting hand pixels values using gauge series
Hi yvb,
Here is an example of how you could find the end point of the hand in VB6. Note that I've hidden the pen and used the calculated end hand point to draw the line where the hand would be.
Here is an example of how you could find the end point of the hand in VB6. Note that I've hidden the pen and used the calculated end hand point to draw the line where the hand would be.
Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scGauge
TChart1.Series(0).asGauge.Value = 70
TChart1.Series(0).Pen.Visible = False
End Sub
Private Sub TChart1_OnAfterDraw()
Dim tmpRange, tmpAngle As Double
Dim EndHandX, EndHandY As Integer
Dim PI As Double
PI = 4 * Math.Atn(1)
With TChart1.Series(0).asGauge
tmpRange = .Maximum - .Minimum
If tmpRange = 0 Then
tmpAngle = 0.5 * PI
Else
tmpAngle = PI / 180 * (360 - (.TotalAngle - ((.Value - .Minimum) * .TotalAngle / tmpRange)) + .RotationAngle)
End If
Dim tmpSin, tmpCos As Double
tmpSin = Sin(tmpAngle)
tmpCos = Cos(tmpAngle)
EndHandX = .XCenter - Round(.XRadius * tmpCos) + Round(.HandDistance * tmpCos)
EndHandY = .YCenter - Round(.YRadius * tmpSin) + Round(.HandDistance * tmpSin)
TChart1.Canvas.Pen.Color = vbRed
TChart1.Canvas.DrawLine .XCenter, .YCenter, EndHandX, EndHandY
End With
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |