|
-
Mar 12th, 2001, 06:16 AM
#1
Thread Starter
New Member
I need help (in more way than one), I'm basically looking to build my own graph using data from values held in a collection. Its for illustrating a heart rate and therefore not a bar or pie chart one! Anybody any clues?
Thanks
Joe
-
Mar 12th, 2001, 06:49 AM
#2
Retired VBF Adm1nistrator
I'd use pset on a picturebox to do it.
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Mar 31st, 2001, 06:28 AM
#3
Thread Starter
New Member
How do I use pset? My data is sitting in a collection, but I've never done any graphics drawing before in vb...
-
Apr 2nd, 2001, 02:11 AM
#4
Retired VBF Adm1nistrator
Well here's a quick 'n easy example ;
This assumes you have a picture box called Picture1 on your form ...
Code:
Option Explicit
Private i As Long
Private Sub Form_Load()
Picture1.AutoRedraw = True
For i = 0 To 1000
Picture1.PSet (Rnd * Picture1.Width, Rnd * Picture1.Height), vbRed
Next i
End Sub
The basic format (that you have to worry about anyway) of PSet is :
Code:
object.PSet (x, y), [color]
If you have any more questions, just let me know.
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 4th, 2001, 03:45 AM
#5
Thread Starter
New Member
kinda working... overflow error
This was my eventual solution, kinda based on your help (and a book!):
CODE:*********************
'*****Display Graph*****
Private Sub cmdShort_click()
Dim X As Long '1st read
Dim Y As Long '1st Read
Dim X1 As Long '2nd Read
Dim Y1 As Long '2nd Read
Dim Xmax As Long
Dim Xmin As Long
Dim Ymax As Long
Dim Ymin As Long
Dim Ymid As Long
'Dim Minute As Integer
'Minute = 7680
Dim i As Long
Dim plot As Long
Dim Yinc As Long
X = picGraph.Width
Y = picGraph.Height
Xmax = (X / 100) * 90
Xmin = (X / 100) * 10
Ymax = (Y / 100) * 10
Ymin = (Y / 100) * 90
'set up Ymid line
Ymid = Ymax + ((Ymin - Ymax) / 2)
'draw Axis
picGraph.Line (Xmin, Ymid)-(Xmax, Ymid)
picGraph.Line (Xmin, Ymin)-(Xmin, Ymax)
'set up increments along Y axis
Yinc = (Ymid - Ymax) / 2000
'initialise variables
i = 1
plot = 1
'read edge variable
Call sobelA.Item(plot)
'assign edge variable to X & Y
Y = Ymid - (plot * Yinc)
X = Xmin
PSet (X, Y)
For i = 1 To sobelA.Count
'Call sobelA.Item(plot)
Y1 = Ymid - (sobelA.Item(plot) * Yinc)
X1 = Xmin + i
'Print sobelA.Item(plot)
picGraph.Line (X, Y)-(X1, Y1)
plot = plot + 1
X = X1
Y = Y1
Next i
The only problem now is that in processing the collection of values there are 7960*30 minutes of data to process. This causes an overflow .... problems problems! ;-)
Joe
-
Apr 4th, 2001, 04:07 AM
#6
Retired VBF Adm1nistrator
Well if you attach your entire project zipped I'll see if I can help ...
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 5th, 2001, 02:06 AM
#7
Retired VBF Adm1nistrator
Thats an interestign looking project you've attached there 
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 5th, 2001, 10:33 AM
#8
Thread Starter
New Member
moving along slowly
Hhhhmmmm, "interesting" actually a bit of a pain in the ... anyway I've moved on a little and am know just normalising the data in minute chunks rather than processing the whole file. I need to work out my loops a little.
Did you have any suggestions?
-
Apr 5th, 2001, 10:47 AM
#9
Retired VBF Adm1nistrator
Well as I dont know what you're actually doing exactly thats rather difficult ....
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 5th, 2001, 10:51 AM
#10
Frenzied Member
Maybe you should compress the file a bit. It's not that hard. You could, for example, instead of keeping the value in every frame, do it only when it changes! Like... the player loses 10hp, so you add to the file the hp lost and the time distance from the last time the hp changed. You'll probably notice the file size decrease from 3mb to something like 3kb 
You should also draw it AS YOU READ THE FILE, that means DON'T KEEP IT IN MEMORY! It's just too big!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|