Solved

PaulHews

Posted on 2001-06-05
8
323 Views
Last Modified: 2010-05-02
PaulHews
I would be grateful for that code on graphing a constant stream of  numbers into a cardiac type graph. Incorporating pic.line etc and a 10point margin either side of the incoming values
I have searched frantically for your last posting on the subject but alas no joy.
Please can you help?
0
Comment
Question by:mishbal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 6155477
mishbal, this is not paul's example but it may be of interest to you. Just place a picture box on a form and a command button, copy this code, run and click the button, the trace will run across the picture box. Click the button again to stop it.

Private Sub Command4_Click()
    Static blnContinue As Boolean
    If blnContinue Then
        blnContinue = False
    Else
        blnContinue = True
    End If
    Dim aryPoints() As Long
    Picture1.ScaleMode = 3
    ReDim aryPoints(Picture1.ScaleWidth)
    aryPoints(UBound(aryPoints)) = Picture1.ScaleHeight / 2
    Do
        intDelta = IIf(Rnd() * 100 > 50, 1, -1)
        For intPoint = LBound(aryPoints) + 1 To UBound(aryPoints)
            Picture1.PSet (intPoint, aryPoints(intPoint - 1)), Picture1.BackColor
            aryPoints(intPoint - 1) = aryPoints(intPoint)
            Picture1.PSet (intPoint, aryPoints(intPoint - 1)), vbBlue
        Next
        aryPoints(UBound(aryPoints)) = aryPoints(UBound(aryPoints) - 1) + intDelta
        DoEvents
    Loop Until blnContinue = False
End Sub
0
 

Author Comment

by:mishbal
ID: 6158919
TimCottee
please forgive our ignorance but where do we input our figures which incidently fluctuate between 1 and 9?
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6160142
mishbal, here is a slightly different version which may be more what you need: The button and the timer are for demonstration purposes. Essentially you just need the AddData Sub. Paste a picture box on the form and away it goes. You need to replace the timer event call to AddData with something which passes your values instead. It may need a bit more modification but I can help you with that if I know a bit more about what you are trying to do.

Private Sub Command4_Click()
   Static blnContinue As Boolean
   If blnContinue Then
       blnContinue = False
   Else
       blnContinue = True
   End If
   Timer1.Enabled = blnContinue
End Sub

Private Sub AddData(ByRef Chart As PictureBox, ByVal Value As Double)
    Static dblLastPoint As Double
    Static aryPoints() As Double
    Dim dblNewPoint As Double
    ReDim Preserve aryPoints(Chart.ScaleWidth / 10)
    For intPoint = LBound(aryPoints) + 1 To UBound(aryPoints)
        Chart.Line ((intPoint - 1) * 10, aryPoints(intPoint - 1))-(intPoint * 10, aryPoints(intPoint)), Chart.BackColor
        aryPoints(intPoint - 1) = aryPoints(intPoint)
    Next
    dblNewPoint = Value * (Chart.ScaleHeight / 10)
    aryPoints(UBound(aryPoints)) = dblNewPoint
    For intPoint = LBound(aryPoints) + 1 To UBound(aryPoints)
        Chart.Line ((intPoint - 1) * 10, aryPoints(intPoint - 1))-(intPoint * 10, aryPoints(intPoint)), vbBlue
    Next
    dblLastPoint = dblNewPoint
    DoEvents
End Sub

Private Sub Timer1_Timer()
    AddData Picture1, (Rnd() * 9) + 1
End Sub
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mishbal
ID: 6160709
THAT'L DO FOR ME MR COTTEE
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6162887
Shall I propose an answer to this or will you accept my comment?
0
 

Author Comment

by:mishbal
ID: 6163431
yes that concludes it TimCottee
you have provided what i want
i have no points left
if you require some then allow me to inform my colleague to imburse you
mishbal
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 275 total points
ID: 6163473
Just accept my answer and all will be well, the 275 you have assigned to this question is plenty. Glad to be of help.
0
 

Author Comment

by:mishbal
ID: 6163482
Thanks TimCottee
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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