|
-
Aug 29th, 2007, 09:22 AM
#1
Thread Starter
Addicted Member
[RESOLVED] could you say how to plot graphs(with co-ordinates) in V.B 6.0?
Hi All,
I want to draw a graph(it is not an un linear data structure). there will be some values on X-co ordinate, and Y-coordinate. now i have to draw a graph for those (x,y) values.
Is it possible in V.B, if so kindly let me know how to do it.
Thanks:
regards:
raghunadhs
-
Aug 29th, 2007, 09:41 AM
#2
-
Aug 29th, 2007, 11:45 AM
#3
Thread Starter
Addicted Member
Re: could you say how to plot graphs(with co-ordinates) in V.B 6.0?
Hi manavo11,
Thanks for your immediate response. i will go through the link what you have mentioned,and let you know feed back if any.
Thanks:
regards:
raghunadhs.
 Originally Posted by manavo11
-
Aug 31st, 2007, 01:32 AM
#4
Thread Starter
Addicted Member
Re: could you say how to plot graphs(with co-ordinates) in V.B 6.0?
Hi Manova,
I have gone through the link, what you have sent. it seems to be a user control,and i could not understand that also(i don't know much about user conrol).
is not there any graph control in v.b? i have seen a chart control, but i don't know how to pass values to that control. can i achieve graph(based on values, it may be like a sine wave also) through this "chart" control? if so kindly let me know it.
Thanks:
regards:
raghunadhs.
-
Aug 31st, 2007, 04:48 AM
#5
Re: could you say how to plot graphs(with co-ordinates) in V.B 6.0?
I think it's fairly easy to plot graphs using the native drawing functions
Code:
Option Explicit
'These are the Constants I like to use when working with radians
Const PI As Single = 3.141593
Const PI° As Single = 0.01745329 'pi/180
Const PI½ As Single = 1.570796 'pi/2
Private Sub Form_Activate()
SineWave1 Picture1
End Sub
Private Sub SineWave1(Tgt As Object)
'Draw a sine wave graph using a User ScaleMode
Dim R As Single, X1 As Single, Y1 As Single, X2 As Single, Y2 As Single
X1 = -PI 'start X
X2 = PI 'end X
Y1 = 1.1 'start y
Y2 = -1.1 'end y
R = PI° 'Plot interval
'Set the User scale
Tgt.Scale (X1, Y1)-(X2, Y2)
'Mark the axis
Tgt.Line (X1, 0)-(X2, 0), &H80000010
Tgt.Line (0, Y1)-(0, Y2), &H80000010
'Position the drawing origin
Tgt.CurrentY = Sin(X1)
Tgt.CurrentX = X1
'Draw the graph
For R = X1 To X2 Step R * Sgn(X2 - X1)
Tgt.Line -(R, Sin(R))
Next R
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.ToolTipText = FormatNumber(X, 2, vbTrue) & ", " & FormatNumber(Y, 2, vbTrue)
End Sub
-
Aug 31st, 2007, 05:09 AM
#6
Thread Starter
Addicted Member
Re: could you say how to plot graphs(with co-ordinates) in V.B 6.0?
Thanks MIlk,
i saw your application, what you have posted. it was very nice.
but i think, i could not explain you my requirement very much. i am sorry for the inconveniance.
in my App, user will provide few pairs of readings (some times it may be floating point also).
egg: (1.234,8.9),(3.45,5.67),(2.0,4.5) ...etc.
Now my aim is i have to plot a graph for these readings.the graph is should be like wave format(like sine wave,means the peaks and base of graph shuold be in a rounded curve shape, not like sharp one). even though user may change his readings frequently, my application should be able to draw accordingly.
If u know it how to do, please let me know that...
Thanks:
regards:
raghunadhs
[QUOTE=Milk]I think it's fairly easy to plot graphs using the native drawing functions[code]Option Explicit
-
Aug 31st, 2007, 06:47 AM
#7
Re: could you say how to plot graphs(with co-ordinates) in V.B 6.0?
ahh not quite so easy then. I wonder if PolyBezier Api will help? You would have to convert your Floating points to long integers and generate the control points some how (maybe the average of each pair will do?). You would also have to do your own scaling because the Api will only work in pixels.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|