473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to plot graph

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.
Jun 18 '07 #1
12 13862
Killer42
8,435 Expert 8TB
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.
Not 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.
Jun 18 '07 #2
Not 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.
I'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.
Jun 18 '07 #3
Killer42
8,435 Expert 8TB
I'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.
Sorry, 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.)
Jun 18 '07 #4
Sorry, 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?

Expand|Select|Wrap|Line Numbers
  1. Public Class UmmAudiogram
  2.  
  3.     Private Sub UmmAudiogram_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
  4.         Dim blackPen As Pen = New Pen(Color.Black, 1.5)
  5.         Dim point1 As Point = New Point(80, 50)
  6.         Dim point2 As Point = New Point(480, 50)
  7.         Me.CreateGraphics.DrawLine(blackPen, point1, point2)
  8.  
  9.         Dim point3 As Point = New Point(80, 70)
  10.         Dim point4 As Point = New Point(480, 70)
  11.         Me.CreateGraphics.DrawLine(blackPen, point3, point4)
  12.  
  13.         Dim point5 As Point = New Point(80, 90)
  14.         Dim point6 As Point = New Point(480, 90)
  15.         Me.CreateGraphics.DrawLine(blackPen, point5, point6)
  16.  
  17.         Dim point7 As Point = New Point(80, 110)
  18.         Dim point8 As Point = New Point(480, 110)
  19.         Me.CreateGraphics.DrawLine(blackPen, point7, point8)
  20.  
  21.         Dim point9 As Point = New Point(80, 130)
  22.         Dim point10 As Point = New Point(480, 130)
  23.         Me.CreateGraphics.DrawLine(blackPen, point9, point10)
  24.  
  25.         Dim point11 As Point = New Point(80, 150)
  26.         Dim point12 As Point = New Point(480, 150)
  27.         Me.CreateGraphics.DrawLine(blackPen, point11, point12)
  28.  
  29.         Dim point13 As Point = New Point(80, 170)
  30.         Dim point14 As Point = New Point(480, 170)
  31.         Me.CreateGraphics.DrawLine(blackPen, point13, point14)
  32.  
  33.         Dim point15 As Point = New Point(80, 190)
  34.         Dim point16 As Point = New Point(480, 190)
  35.         Me.CreateGraphics.DrawLine(blackPen, point15, point16)
  36.  
  37.         Dim point17 As Point = New Point(80, 210)
  38.         Dim point18 As Point = New Point(480, 210)
  39.         Me.CreateGraphics.DrawLine(blackPen, point17, point18)
  40.  
  41.         Dim point19 As Point = New Point(80, 230)
  42.         Dim point20 As Point = New Point(480, 230)
  43.         Me.CreateGraphics.DrawLine(blackPen, point19, point20)
  44.  
  45.         Dim point21 As Point = New Point(80, 250)
  46.         Dim point22 As Point = New Point(480, 250)
  47.         Me.CreateGraphics.DrawLine(blackPen, point21, point22)
  48.  
  49.         Dim point23 As Point = New Point(80, 270)
  50.         Dim point24 As Point = New Point(480, 270)
  51.         Me.CreateGraphics.DrawLine(blackPen, point23, point24)
  52.  
  53.         Dim point25 As Point = New Point(80, 290)
  54.         Dim point26 As Point = New Point(480, 290)
  55.         Me.CreateGraphics.DrawLine(blackPen, point25, point26)
  56.  
  57.         Dim point27 As Point = New Point(80, 310)
  58.         Dim point28 As Point = New Point(480, 310)
  59.         Me.CreateGraphics.DrawLine(blackPen, point27, point28)
  60.  
  61.         Dim pointA As Point = New Point(80, 50)
  62.         Dim pointB As Point = New Point(80, 310)
  63.         Me.CreateGraphics.DrawLine(blackPen, pointA, pointB)
  64.  
  65.         Dim pointC As Point = New Point(100, 50)
  66.         Dim pointD As Point = New Point(100, 310)
  67.         Me.CreateGraphics.DrawLine(blackPen, pointC, pointD)
  68.  
  69.         Dim pointE As Point = New Point(120, 50)
  70.         Dim pointF As Point = New Point(120, 310)
  71.         Me.CreateGraphics.DrawLine(blackPen, pointE, pointF)
  72.  
  73.         Dim pointG As Point = New Point(140, 50)
  74.         Dim pointH As Point = New Point(140, 310)
  75.         Me.CreateGraphics.DrawLine(blackPen, pointG, pointH)
  76.  
  77.         Dim pointI As Point = New Point(160, 50)
  78.         Dim pointJ As Point = New Point(160, 310)
  79.         Me.CreateGraphics.DrawLine(blackPen, pointI, pointJ)
  80.  
  81.         Dim pointK As Point = New Point(180, 50)
  82.         Dim pointL As Point = New Point(180, 310)
  83.         Me.CreateGraphics.DrawLine(blackPen, pointK, pointL)
  84.  
  85.         Dim pointM As Point = New Point(200, 50)
  86.         Dim pointN As Point = New Point(200, 310)
  87.         Me.CreateGraphics.DrawLine(blackPen, pointM, pointN)
  88.  
  89.         Dim pointO As Point = New Point(220, 50)
  90.         Dim pointP As Point = New Point(220, 310)
  91.         Me.CreateGraphics.DrawLine(blackPen, pointO, pointP)
  92.  
  93.         Dim pointQ As Point = New Point(240, 50)
  94.         Dim pointR As Point = New Point(240, 310)
  95.         Me.CreateGraphics.DrawLine(blackPen, pointQ, pointR)
  96.  
  97.         Dim pointS As Point = New Point(260, 50)
  98.         Dim pointT As Point = New Point(260, 310)
  99.         Me.CreateGraphics.DrawLine(blackPen, pointS, pointT)
  100.  
  101.         Dim pointU As Point = New Point(280, 50)
  102.         Dim pointV As Point = New Point(280, 310)
  103.         Me.CreateGraphics.DrawLine(blackPen, pointU, pointV)
  104.  
  105.         Dim pointW As Point = New Point(300, 50)
  106.         Dim pointX As Point = New Point(300, 310)
  107.         Me.CreateGraphics.DrawLine(blackPen, pointW, pointX)
  108.  
  109.         Dim pointY As Point = New Point(320, 50)
  110.         Dim pointZ As Point = New Point(320, 310)
  111.         Me.CreateGraphics.DrawLine(blackPen, pointY, pointZ)
  112.  
  113.         Dim pointAa As Point = New Point(340, 50)
  114.         Dim pointAb As Point = New Point(340, 310)
  115.         Me.CreateGraphics.DrawLine(blackPen, pointAa, pointAb)
  116.  
  117.         Dim pointAc As Point = New Point(360, 50)
  118.         Dim pointAd As Point = New Point(360, 310)
  119.         Me.CreateGraphics.DrawLine(blackPen, pointAc, pointAd)
  120.  
  121.         Dim pointAe As Point = New Point(380, 50)
  122.         Dim pointAf As Point = New Point(380, 310)
  123.         Me.CreateGraphics.DrawLine(blackPen, pointAe, pointAf)
  124.  
  125.         Dim pointAg As Point = New Point(400, 50)
  126.         Dim pointAh As Point = New Point(400, 310)
  127.         Me.CreateGraphics.DrawLine(blackPen, pointAg, pointAh)
  128.  
  129.         Dim pointAi As Point = New Point(420, 50)
  130.         Dim pointAj As Point = New Point(420, 310)
  131.         Me.CreateGraphics.DrawLine(blackPen, pointAi, pointAj)
  132.  
  133.         Dim pointAk As Point = New Point(440, 50)
  134.         Dim pointAl As Point = New Point(440, 310)
  135.         Me.CreateGraphics.DrawLine(blackPen, pointAk, pointAl)
  136.  
  137.         Dim pointAm As Point = New Point(460, 50)
  138.         Dim pointAn As Point = New Point(460, 310)
  139.         Me.CreateGraphics.DrawLine(blackPen, pointAm, pointAn)
  140.  
  141.         Dim pointAo As Point = New Point(480, 50)
  142.         Dim pointAp As Point = New Point(480, 310)
  143.         Me.CreateGraphics.DrawLine(blackPen, pointAo, pointAp)
  144.         Dim G As Graphics = e.Graphics
  145.         Dim pen1 As New Pen(Color.Red, 2)
  146.         Dim pen2 As New Pen(Color.DarkBlue, 2)
  147.  
  148.  
  149.         Dim x As Integer
  150.         Dim y As Integer
  151.         Dim thresholdeLabel As Integer = 0
  152.         Dim freqqLabel As Integer = 0
  153.         Dim pt As Integer(,) = New Integer(x, y) {}
  154.         pt(200, 50) = freqqLabel
  155.         pt(200, 70) = freqqLabel
  156.         pt(200, 110) = freqqLabel
  157.  
  158.         For thresholdeLabel = 20 To pt(200, 110).ToString
  159.  
  160.         Next
  161.  
  162.         G.DrawLine(pen1, (x - 5), (y - 5), (x + 5), (y + 5)) 'drawing 'x'
  163.         G.DrawLine(pen1, (x + 5), (y - 5), (x - 5), (y + 5))
  164.  
  165.  
  166.         G.DrawLine(pen1, 115, 105, 125, 115) 'drawing 'x'
  167.         G.DrawLine(pen1, 125, 105, 115, 115)
  168.  
  169.         G.DrawLine(pen1, 195, 65, 205, 75)
  170.         G.DrawLine(pen1, 205, 65, 195, 75)
  171.  
  172.         G.DrawLine(pen1, 190, 130, 200, 125)
  173.         G.DrawLine(pen1, 190, 130, 200, 135) 'drawing '<'
  174.  
  175.         'draw '>'
  176.         G.DrawLine(pen2, 130, 110, 120, 115)
  177.         G.DrawLine(pen2, 130, 110, 120, 105)
  178.  
  179.         'drawing 'o'
  180.         Dim p1 As New Point(140, 86)
  181.         Dim p2 As New Point(144, 90)
  182.         Dim p3 As New Point(140, 94)
  183.         Dim p4 As New Point(136, 90)
  184.         Dim curvePoints As Point() = {p1, p2, p3, p4}
  185.         e.Graphics.DrawClosedCurve(pen2, curvePoints)
  186.  
  187.  
  188.     End Sub
  189. End Class
Jun 19 '07 #5
Killer42
8,435 Expert 8TB
it's a paint event. here are my codes. even the symbols i'm drawing. How exactly do I use the .print method?
Sorry, 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.
Jun 19 '07 #6
Sorry, 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 ('',)
Jun 19 '07 #7
Killer42
8,435 Expert 8TB
alright. thanks alot killer42. appreciate it ('',)
No 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.
Jun 19 '07 #8
Hello
Can you help me in real timeplotting. I don't know how it could be possible.
Sep 6 '07 #9
Killer42
8,435 Expert 8TB
Hello
Can you help me in real timeplotting. I don't know how it could be possible.
I don't know what you mean. What is timeplotting?
Sep 6 '07 #10
I don't know what you mean. What is timeplotting?
Real 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?
Sep 6 '07 #11
hariharanmca
1,977 1GB
No 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.
Killer42, I think we have to Move this thread to .NET forum!

Because, .NET version of VB and VB 2005 version coding style are more-or-less same.
Sep 6 '07 #12
Real 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?
Hi,
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)
Oct 10 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jan Rienyer Gadil | last post by:
could anyone please help me! what and how is the best implementation of creating a table based on data coming from the serial port ? and also how would i be able to create graphs (2D) based on...
1
by: Soon Lee | last post by:
any one know of any good way to plot graph using vb.net?
3
by: arda | last post by:
i have a program and this program has output values and i wanna draw a 2D graph for these outputs. How can i achieve this?
3
by: siyoyok007 | last post by:
hello guys, my system needs the use of graph but i don't know the step on doing it. I use microsoft access as the database and want to convert it into a graph. can anyone give some examples or link...
3
by: ray | last post by:
Hi, I would like to ask how to plot graph in vb.net on the interface? Is it possible? Thanks a lot, Ray
0
by: mostafijur | last post by:
Hello I want to show continuous graph using Gnu plot. That means after 1 hour I want to see previous every 10 mins graph. Gnu Plot Version: 4.0, Linux kernel: 2.6, UBUNTU I can access Gnu...
5
by: 9jaguy | last post by:
Guys, I treally appreciate the way questions are answered on this forum. I hope I get someone to help on this quickly too. :) I am using vb 2005 and getting data directly from two sensors in two...
0
by: peridian | last post by:
Hi, I have an image of an equilateral triangle, where the base of the triangle meets the base of the image perfectly. The image itself is square. I need to be able to dynamically plot out...
2
by: maximus tee | last post by:
hi all, i'm new to python and this is advanced for me. is there a way to plot data with python? i want to plot EyVt, EyHt on the Y-axis and Lane on the X-axis as attached or below. currently...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.