Results 1 to 11 of 11

Thread: how to draw graph in VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    kl
    Posts
    7

    Arrow

    graph in vb
    bbng

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    MSChart Control.

    Would you care to share a few more words?
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    Graph

    put a command button named cmdRun on your form and a Graph1 on your form. Paste this code in the window and play with it. I got this off the net.
    Code:
    Private Sub cmdRun_Click()
    Dim i As Integer
    '
    ' This tells the graph what type of graph you need
    ' Options included are: gphArea,gphBar2D,gphBar3D,
    ' gphGantt,gphHLC,gphLine,gphLogLin,gphNone,gphPie2D
    ' gphPie3D,gphPolar,gphScatter
    '
    Graph1.GraphType = 4 ' put this number to the style you want
    '
    ' Clears Graph
    '
    Graph1.DataReset = gphAllData
    '
    ' NumPoints = 20 must be correct or you'll get an error
    '
    Graph1.NumPoints = 20
    '
    ' Allows for multiple lines (This example has only one line)
    '
    Graph1.NumSets = 1
    '
    ' This must be set to 0 for the x-y plotting to work
    ' I have no idea why!
    '
    Graph1.AutoInc = 0
    '
    ' This is a good example how VB has taken something totally
    ' simple and made it complicated (4 lines to do the work of 1)
    '
    For i = 1 To 20
    Graph1.ThisSet = 1
    Graph1.ThisPoint = i
    Graph1.GraphData = Sin(i * 3.1415 / 10)
    Graph1.LabelText = Format(3.1415 * i / 5, "##0.00")
    Next i
    '
    ' Set the y axis scale.  This took me two days to figure out
    ' You need to click on the graph go to properties select
    ' (Custom) click on scales and pick user defined or the
    ' yAxisMin-Max will not work. Isn't that clever?
    '
    Graph1.YAxisMax = 1.5
    Graph1.YAxisMin = -1.5
    '
    ' Draws the graph
    '
    Graph1.DrawMode = gphDraw
    End Sub
    Kokopeli
    VB6 SP3

  4. #4
    Member
    Join Date
    Jun 2000
    Posts
    45
    kokopeli or anyone who knows:

    - what kind of object are you using "Graph1" is it MSChart? - How do I get hold of the object, so I can use it within VB6?
    - Can I use that object when I'm creating my own activeX object?


  5. #5
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    MSChart

    Look in bbng's other questions. Someone left a link to MSDN site. You have to remove Option Explicit in the example they give you.
    Kokopeli
    VB6 SP3

  6. #6
    New Member
    Join Date
    Oct 2019
    Posts
    2

    Re: how to draw graph in VB

    Quote Originally Posted by jess View Post
    kokopeli or anyone who knows:

    - what kind of object are you using "Graph1" is it MSChart? - How do I get hold of the object, so I can use it within VB6?
    - Can I use that object when I'm creating my own activeX object?
    Hi.

    Graph1 came from the library GraphLib (see the example).

    Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
    Object = "{0842D103-1E19-101B-9AAF-1A1626551E7C}#1.0#0"; "graph32.ocx"
    Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "threed32.ocx"
    Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MShflxgd.ocx"

    Begin GraphLib.Graph GRAPH1
    Height = 5895
    Left = 240
    TabIndex = 10
    Top = 120
    Width = 6015
    _Version = 65536
    _ExtentX = 10610
    _ExtentY = 10398
    _StockProps = 96
    BorderStyle = 1
    BottomTitle = "Frequency MHz"
    GraphStyle = 4
    GraphType = 6
    GridStyle = 3
    IndexStyle = 1
    LeftTitle = "System Return Loss dB"
    LegendStyle = 1
    RandomData = 0
    ThickLines = 0
    YAxisMax = -20
    YAxisMin = -40
    YAxisStyle = 2
    ColorData = 0
    ExtraData = 0
    ExtraData[] = 0
    FontFamily = 4
    FontSize = 4
    FontSize[0] = 200
    FontSize[1] = 150
    FontSize[2] = 100
    FontSize[3] = 100
    FontStyle = 4
    GraphData = 1
    GraphData[] = 5
    GraphData[0,0] = 0
    GraphData[0,1] = 0
    GraphData[0,2] = 0
    GraphData[0,3] = 0
    GraphData[0,4] = 0
    LabelText = 0
    LegendText = 0
    PatternData = 1
    PatternData[0] = 5
    SymbolData = 3
    SymbolData[1] = 3
    SymbolData[2] = 1
    XPosData = 0
    XPosData[] = 0
    End


    PS. I have used this 4 object too. Actually not every object is mandatory.
    ComDlg32.OCX, graph32.ocx, threed32.ocx, MShflxgd.ocx;

  7. #7
    New Member
    Join Date
    Oct 2019
    Posts
    2

    Re: how to draw graph in VB

    Quote Originally Posted by jess View Post
    kokopeli or anyone who knows:

    - what kind of object are you using "Graph1" is it MSChart? - How do I get hold of the object, so I can use it within VB6?
    - Can I use that object when I'm creating my own activeX object?


    Hi.
    I use it with VB6.
    Maybe it works with VB5 too.
    Graph1 came from the library GraphLib (see the example).

    Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
    Object = "{0842D103-1E19-101B-9AAF-1A1626551E7C}#1.0#0"; "graph32.ocx"
    Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "threed32.ocx"
    Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MShflxgd.ocx"

    Begin GraphLib.Graph GRAPH1
    Height = 5895
    Left = 240
    TabIndex = 10
    Top = 120
    Width = 6015
    _Version = 65536
    _ExtentX = 10610
    _ExtentY = 10398
    _StockProps = 96
    BorderStyle = 1
    BottomTitle = "Frequency MHz"
    GraphStyle = 4
    GraphType = 6
    GridStyle = 3
    IndexStyle = 1
    LeftTitle = "System Return Loss dB"
    LegendStyle = 1
    RandomData = 0
    ThickLines = 0
    YAxisMax = -20
    YAxisMin = -40
    YAxisStyle = 2
    ColorData = 0
    ExtraData = 0
    ExtraData[] = 0
    FontFamily = 4
    FontSize = 4
    FontSize[0] = 200
    FontSize[1] = 150
    FontSize[2] = 100
    FontSize[3] = 100
    FontStyle = 4
    GraphData = 1
    GraphData[] = 5
    GraphData[0,0] = 0
    GraphData[0,1] = 0
    GraphData[0,2] = 0
    GraphData[0,3] = 0
    GraphData[0,4] = 0
    LabelText = 0
    LegendText = 0
    PatternData = 1
    PatternData[0] = 5
    SymbolData = 3
    SymbolData[1] = 3
    SymbolData[2] = 1
    XPosData = 0
    XPosData[] = 0
    End


    PS. I have used this 4 object too. Actually not every object is mandatory.
    ComDlg32.OCX, graph32.ocx, threed32.ocx, MShflxgd.ocx;

  8. #8
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to draw graph in VB

    If wanting to use graph32.ocx, suggest reading this other thread
    http://www.vbforums.com/showthread.p...57-Vb6-graph32

    Oh, and any suggestion to remove Option Explicit is not a good suggestion IMO. If you get compile errors due to variables not declared, simply fix that by declaring the variables.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,738

    Re: how to draw graph in VB

    It was a reply to a thread dating back to 2000, 19 years ago...
    I don't think the Topic Starter is still waiting for an answer

  10. #10
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to draw graph in VB

    Quote Originally Posted by Arnoutdv View Post
    It was a reply to a thread dating back to 2000, 19 years ago...
    I don't think the Topic Starter is still waiting for an answer
    Ugh, got me. I'm usually pretty good at spotting those
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: how to draw graph in VB

    Yeah, it's old...but it's also pretty odd. Is this a response to a different question?
    My usual boring signature: Nothing

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