i'm using vb to plot graph. i've already drawn the graphsheet using drawlines. and include labels. all i arrange according to pixels. the problem i face now is that i need to plot certain symbols like 'x', 'o' , '>' etc. on the graph. not by drawing but automatically when it get's the value from a label. how do i do that? i think i have to use array. but i cant get through what i want to do. help pls.
how to plot graph
Collapse
X
-
Originally posted by slowgirli'm using vb to plot graph. i've already drawn the graphsheet using drawlines. and include labels. all i arrange according to pixels. the problem i face now is that i need to plot certain symbols like 'x', 'o' , '>' etc. on the graph. not by drawing but automatically when it get's the value from a label. how do i do that? i think i have to use array. but i cant get through what i want to do. help pls.
In VB6 at least, I believe you can simply use the .Print method to print letters/symbols directly on the form or picturebox, or place transparent labels at the appropriate points so that their caption appears to be on the form/picturebox. -
Originally posted by Killer42Not sure exactly what part of this is the problem. (Also, what version of VB are you using?)
In VB6 at least, I believe you can simply use the .Print method to print letters/symbols directly on the form or picturebox, or place transparent labels at the appropriate points so that their caption appears to be on the form/picturebox.Comment
-
Originally posted by slowgirlI'm using vb 2005 express edition. my problem here is that I have drawn the graphsheet using drawlines. I've simply added labels and arrange them according to the pixels corresponding to the lines i've drawn. Now, I need to plot the graph with symbols which I have created, also by drawing. But my program should work in such a way that I can automatically plot that certain symbol when it gets the value from a label from another form from the same project.Comment
-
Originally posted by Killer42Sorry, I still don't understand the problem. Why can't you just .Print the symbols onto the "graphsheet "? It would help if you could describe your setup. What exactly is the graphsheet? A picturebox? (I use VB6, so I may be just missing something that's obvious in VB 2005.)
it's a paint event. here are my codes. even the symbols i'm drawing. How exactly do I use the .print method?
[CODE=vbnet]Public Class UmmAudiogram
Private Sub UmmAudiogram_Pa int(ByVal sender As Object, ByVal e As System.Windows. Forms.PaintEven tArgs) Handles Me.Paint
Dim blackPen As Pen = New Pen(Color.Black , 1.5)
Dim point1 As Point = New Point(80, 50)
Dim point2 As Point = New Point(480, 50)
Me.CreateGraphi cs.DrawLine(bla ckPen, point1, point2)
Dim point3 As Point = New Point(80, 70)
Dim point4 As Point = New Point(480, 70)
Me.CreateGraphi cs.DrawLine(bla ckPen, point3, point4)
Dim point5 As Point = New Point(80, 90)
Dim point6 As Point = New Point(480, 90)
Me.CreateGraphi cs.DrawLine(bla ckPen, point5, point6)
Dim point7 As Point = New Point(80, 110)
Dim point8 As Point = New Point(480, 110)
Me.CreateGraphi cs.DrawLine(bla ckPen, point7, point8)
Dim point9 As Point = New Point(80, 130)
Dim point10 As Point = New Point(480, 130)
Me.CreateGraphi cs.DrawLine(bla ckPen, point9, point10)
Dim point11 As Point = New Point(80, 150)
Dim point12 As Point = New Point(480, 150)
Me.CreateGraphi cs.DrawLine(bla ckPen, point11, point12)
Dim point13 As Point = New Point(80, 170)
Dim point14 As Point = New Point(480, 170)
Me.CreateGraphi cs.DrawLine(bla ckPen, point13, point14)
Dim point15 As Point = New Point(80, 190)
Dim point16 As Point = New Point(480, 190)
Me.CreateGraphi cs.DrawLine(bla ckPen, point15, point16)
Dim point17 As Point = New Point(80, 210)
Dim point18 As Point = New Point(480, 210)
Me.CreateGraphi cs.DrawLine(bla ckPen, point17, point18)
Dim point19 As Point = New Point(80, 230)
Dim point20 As Point = New Point(480, 230)
Me.CreateGraphi cs.DrawLine(bla ckPen, point19, point20)
Dim point21 As Point = New Point(80, 250)
Dim point22 As Point = New Point(480, 250)
Me.CreateGraphi cs.DrawLine(bla ckPen, point21, point22)
Dim point23 As Point = New Point(80, 270)
Dim point24 As Point = New Point(480, 270)
Me.CreateGraphi cs.DrawLine(bla ckPen, point23, point24)
Dim point25 As Point = New Point(80, 290)
Dim point26 As Point = New Point(480, 290)
Me.CreateGraphi cs.DrawLine(bla ckPen, point25, point26)
Dim point27 As Point = New Point(80, 310)
Dim point28 As Point = New Point(480, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, point27, point28)
Dim pointA As Point = New Point(80, 50)
Dim pointB As Point = New Point(80, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointA, pointB)
Dim pointC As Point = New Point(100, 50)
Dim pointD As Point = New Point(100, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointC, pointD)
Dim pointE As Point = New Point(120, 50)
Dim pointF As Point = New Point(120, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointE, pointF)
Dim pointG As Point = New Point(140, 50)
Dim pointH As Point = New Point(140, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointG, pointH)
Dim pointI As Point = New Point(160, 50)
Dim pointJ As Point = New Point(160, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointI, pointJ)
Dim pointK As Point = New Point(180, 50)
Dim pointL As Point = New Point(180, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointK, pointL)
Dim pointM As Point = New Point(200, 50)
Dim pointN As Point = New Point(200, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointM, pointN)
Dim pointO As Point = New Point(220, 50)
Dim pointP As Point = New Point(220, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointO, pointP)
Dim pointQ As Point = New Point(240, 50)
Dim pointR As Point = New Point(240, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointQ, pointR)
Dim pointS As Point = New Point(260, 50)
Dim pointT As Point = New Point(260, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointS, pointT)
Dim pointU As Point = New Point(280, 50)
Dim pointV As Point = New Point(280, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointU, pointV)
Dim pointW As Point = New Point(300, 50)
Dim pointX As Point = New Point(300, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointW, pointX)
Dim pointY As Point = New Point(320, 50)
Dim pointZ As Point = New Point(320, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointY, pointZ)
Dim pointAa As Point = New Point(340, 50)
Dim pointAb As Point = New Point(340, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAa, pointAb)
Dim pointAc As Point = New Point(360, 50)
Dim pointAd As Point = New Point(360, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAc, pointAd)
Dim pointAe As Point = New Point(380, 50)
Dim pointAf As Point = New Point(380, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAe, pointAf)
Dim pointAg As Point = New Point(400, 50)
Dim pointAh As Point = New Point(400, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAg, pointAh)
Dim pointAi As Point = New Point(420, 50)
Dim pointAj As Point = New Point(420, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAi, pointAj)
Dim pointAk As Point = New Point(440, 50)
Dim pointAl As Point = New Point(440, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAk, pointAl)
Dim pointAm As Point = New Point(460, 50)
Dim pointAn As Point = New Point(460, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAm, pointAn)
Dim pointAo As Point = New Point(480, 50)
Dim pointAp As Point = New Point(480, 310)
Me.CreateGraphi cs.DrawLine(bla ckPen, pointAo, pointAp)
Dim G As Graphics = e.Graphics
Dim pen1 As New Pen(Color.Red, 2)
Dim pen2 As New Pen(Color.DarkB lue, 2)
Dim x As Integer
Dim y As Integer
Dim thresholdeLabel As Integer = 0
Dim freqqLabel As Integer = 0
Dim pt As Integer(,) = New Integer(x, y) {}
pt(200, 50) = freqqLabel
pt(200, 70) = freqqLabel
pt(200, 110) = freqqLabel
For thresholdeLabel = 20 To pt(200, 110).ToString
Next
G.DrawLine(pen1 , (x - 5), (y - 5), (x + 5), (y + 5)) 'drawing 'x'
G.DrawLine(pen1 , (x + 5), (y - 5), (x - 5), (y + 5))
G.DrawLine(pen1 , 115, 105, 125, 115) 'drawing 'x'
G.DrawLine(pen1 , 125, 105, 115, 115)
G.DrawLine(pen1 , 195, 65, 205, 75)
G.DrawLine(pen1 , 205, 65, 195, 75)
G.DrawLine(pen1 , 190, 130, 200, 125)
G.DrawLine(pen1 , 190, 130, 200, 135) 'drawing '<'
'draw '>'
G.DrawLine(pen2 , 130, 110, 120, 115)
G.DrawLine(pen2 , 130, 110, 120, 105)
'drawing 'o'
Dim p1 As New Point(140, 86)
Dim p2 As New Point(144, 90)
Dim p3 As New Point(140, 94)
Dim p4 As New Point(136, 90)
Dim curvePoints As Point() = {p1, p2, p3, p4}
e.Graphics.Draw ClosedCurve(pen 2, curvePoints)
End Sub
End Class[/CODE]Comment
-
Originally posted by slowgirlit's a paint event. here are my codes. even the symbols i'm drawing. How exactly do I use the .print method?Comment
-
Originally posted by Killer42Sorry, I can't answer that. I'm only a VB6 user, and from your code I can see that this stuff works somewhat differently in VB2005. In VB6 you would simply use the .Print method of the form or picturebox control, like Picture1.Print "ABC". In VB20005, I have no idea. Try checking out your doco, see whether there's an equivalent.
alright. thanks alot killer42. appreciate it ('',)Comment
-
Originally posted by Killer42I don't know what you mean. What is timeplotting?
ok you just tell me the commands of simple plotting of data. can u help me in this regard?Comment
-
Originally posted by Killer42No problem.
Um... it might not hurt to drop a message in the .Net forum, too - perhaps you'll find more VB.Net experience over there.
Because, .NET version of VB and VB 2005 version coding style are more-or-less same.Comment
-
Originally posted by IshascpReal time plotting means as the values are generated by the code using mathematical fomulae they are plotted.but how it could be possible?
ok you just tell me the commands of simple plotting of data. can u help me in this regard?
I think that you should declare points array:
Dim arr() as pointf
then you should fill its fields from your code.
redim arr(n)
' n is number of points
for i=1 to n
' values are generated by the code using mathematical fomulae
arr(i-1).x= what you want
arr(i-1).y= what you want
End for
Then you should plot this array by graphics object and pen like:
graphics_object .drawcurve(pen, points array)Comment
Comment