CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Plotting Graphs

  1. #1
    Join Date
    Apr 1999
    Posts
    19

    Plotting Graphs

    How do I plot graphs in visual basic.
    I have 2 sets of array values (one for x axis, one for y axis).
    Could you provide me examples on how to plot graphs?

    Thank You.
    Dev.


  2. #2
    Join Date
    May 2001
    Location
    Russia
    Posts
    200

    Re: Plotting Graphs

    Sub PlotGraph(x(),y())
    ScaleMode = 3 'set scale in pixel
    DrawWidth = 8 'set width line
    for i = 0 to UBound(x) - 1
    Line (x(i), y(i))-(x(i + 1), y(i + 1))
    next i
    End Sub




    Andy Tower

  3. #3
    Join Date
    May 2001
    Location
    domodossola,italy
    Posts
    10

    Re: Plotting Graphs

    Add a msChart to your formadd this code under command 1Option Explicit
    Private Sub Command1_Click()With MSChart1 Dim arrData(1 To 3, 1 To 3)
    arrData(1, 1) = "Jan" ' Set the labels in thefirst series.
    arrData(2, 1) = "Feb" arrData(3, 1) = "Mar" arrData(1, 2) = 8
    arrData(2, 2) = 4 arrData(3, 2) = 0.3 arrData(1, 3) = 0.2
    arrData(2, 3) = 3 arrData(3, 3) = 6.3 MSChart1.ChartData = arrData
    End WithEnd Sub


  4. #4
    Join Date
    Jul 2001
    Posts
    5

    Re: Plotting Graphs


    'You mean:
    'Add a msChart to your form
    'add this code under command 1
    option Explicit
    private Sub Command1_Click()
    Dim arrData(1 to 3, 1 to 3)
    arrData(1, 1) = "Jan" ' set the labels in thefirst series.
    arrData(2, 1) = "Feb"
    arrData(3, 1) = "Mar"
    arrData(1, 2) = 8
    arrData(2, 2) = 4
    arrData(3, 2) = 0.3
    arrData(1, 3) = 0.2
    arrData(2, 3) = 3
    arrData(3, 3) = 6.3
    MSChart1.ChartData = arrData
    End Sub



    Next time enclose your post in *[vbocde]* and *[/vbcode]* tags (without "*" chars)


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

Featured