Results 1 to 3 of 3

Thread: How to Make XY Graph In VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    11

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to Make XY Graph In VB

    Thread Moved
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Lively Member
    Join Date
    Sep 2008
    Posts
    77

    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
    Last edited by nin6_8; Nov 13th, 2008 at 04:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width