chart, curve

Posted on 2005-05-14
Last Modified: 2013-12-25
Dear experts

  i made a simple application that reads 8 numbers each second, i need to make a moving 8 curves that illustrate the imprted values,

any advice

Question by:omarmf
    LVL 27

    Expert Comment

    Hi omarmf:
    1) Create a new form to display the chart
    2) Add a PictureBox on the form, so it covers most of the form
    3) Use Line to plot your points

    Here is an example from VB help, that draws on the form itself. In your case use Picture1.Line instead of just Line

    Sub Form_Click ()
       Dim CX, CY, F, F1, F2, I   ' Declare variables
       ScaleMode = 3   ' Set ScaleMode to pixels.
       CX = ScaleWidth / 2   ' Get horizontal center.
       CY = ScaleHeight / 2   ' Get vertical center.
       DrawWidth = 8   ' Set DrawWidth.
       For I = 50 To 0 Step -2
          F = I / 50   ' Perform interim
          F1 = 1 - F: F2 = 1 + F   ' calculations.
          Forecolor = QBColor(I Mod 15)   ' Set foreground color.
          Line (CX * F1, CY * F1)-(CX * F2, CY * F2), , BF
       Next I
       DoEvents   ' Yield for other processing.
       If CY > CX Then   ' Set DrawWidth.
          DrawWidth = ScaleWidth / 25
          DrawWidth = ScaleHeight / 25
       End If
       For I = 0 To 50 Step 2   ' Set up loop.
          F = I / 50   ' Perform interim
          F1 = 1 - F: F2 = 1 + F   ' calculations.
          Line (CX * F1, CY)-(CX, CY * F1)   ' Draw upper-left.
          Line -(CX * F2, CY)   ' Draw upper-right.
          Line -(CX, CY * F2)   ' Draw lower-right.
          Line -(CX * F1, CY)   ' Draw lower-left.
          Forecolor = QBColor(I Mod 15)   ' Change color each time.
       Next I
       DoEvents   ' Yield for other processing.
    End Sub


    Author Comment

    Can you please make a more simple one

    like one line ( y= x^2)

    thank you

    LVL 27

    Accepted Solution

    Here is an "inverted" x^2

    Private Sub Command1_Click()
    Dim x As Integer
    Picture1.ScaleMode = 3
        For x = 1000 To 0 Step -1
            Picture1.Line (x, x ^ 2)-(x + 1, (x + 1) ^ 2)
    End Sub


    Author Comment

    ok done

    than you


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Port V2 16 35
    add text to end of existing text in file 16 54
    MS Access - Capture pressed key onclick 4 18
    Using "ScreenUpdating" 6 36
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now