• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

chart, curve

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

Omar
0
omarmf
Asked:
omarmf
  • 2
  • 2
1 Solution
 
DabasCommented:
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
   Else
      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


Dabas
0
 
omarmfAuthor Commented:
Can you please make a more simple one

like one line ( y= x^2)

thank you

Omar
0
 
DabasCommented:
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)
    Next
End Sub


Dabas
0
 
omarmfAuthor Commented:
ok done

than you

Omar
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now