How to Make XY Graph In VB
Hi,
I have the following x and y coordinates.
x y
== ==
2 4
5 7
11 4
9 20
How to draw the x-y graphs with a straight line start from origin (0,0) connected to each coordinate (x,y). Most of the tutorial that i know don;t show details of the steps and not similar at all.
Thanks guys
Re: How to Make XY Graph In VB
Re: How to Make XY Graph In VB
Assuming you already have it scaled properly, it's pretty simple.
Code:
picturebox.line (x1,y1)-(x2,y2)
consider x1 and y1 the coordinates of the first point, and x2,y2 as the second point, connecting the two with a straight line.
I'll do the scale, the basic lines for the graph, and the first two lines. go ahead do the last two yourself, see how simple it is.
Code:
Private Sub Command1_Click()
picOutput.Scale (-2, 30)-(30, -3) 'Scales the graph
picOutput.Line (-2, 0)-(30, 0) 'Draws x-axis
picOutput.Line (0, -3)-(0, 30) 'Draws y-axis
picOutput.line (0,0)-(2,4) ' First line
picOutput.Line (2, 4)-(5, 7) 'second line
End Sub