Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 23rd, 2004, 06:28 AM
Registered User
Join Date: Aug 2004
Location: Linköping, , Sweden.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to johol545
Default Visualize data in Compact Framework

I'm receiving a stream of data captured from some ECG-equipment via Bluetooth. I save the data in an array but I'd also like to show the data in "real time".

What is the best approach? Now I use a bitmap in witch i draw lines like
bmpGraphics.DrawLine(blackpen, oldX, lastPlottedValue, oldX++, newValue)
but that's too slow. I call
for every 10:th value plotted.

I have to plot at at least 400Hz. Any suggestions? Any nice (free) component that can help me? Any nice methods to use?

Example code:
private void port_DataReceived() 
            while(port.InBufferCount > 1) 
                // Read two bytes from port and save them as a short in the array
                dataStorage[recievedValues++] = BitConverter.ToInt16(port.Input, 0);

                // Update the GUI every 10th reception
                if(recievedValues % 20 == 0) 
                        this.Invoke(new EventHandler(updateGUI));
                    catch(Exception e) 

        private void updateGUI(object o, EventArgs e) 
            // Update the recieved values label.
            label2.Text = recievedValues.ToString();
            // Draw the graph

        private void hScrollBar1_ValueChanged_1(object sender, System.EventArgs e)
            this.graph_panel.Left = -this.hScrollBar1.Value;

        private void drawGraph() 
            // Do this as many times as there's unplotted values.
            for(int i = 0; i < recievedValues - plottedValues; i++) 
                // Calculate new y-value to plot
                int y2 = (int)((dataStorage[plottedValues + 1] - short.MinValue) / yscale);

                // Draw a line from last plotted point to the one calculated above
                bmpGraphics.DrawLine(blackpen, plottedValues, lastPlottedValue, plottedValues + 1, y2);

                // Increase plotted values counter

                // Save the plotted value to use as starting point for next line
                lastPlottedValue = y2;

                // Set the scroll bar into right position
                hScrollBar1.Maximum = plottedValues - hScrollBar1.Width; // Should be width of something else, but it didn't work =(
                hScrollBar1.Value = hScrollBar1.Maximum;

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFileDialog on .NET Compact Framework yukijocelyn C# 2005 0 July 4th, 2008 11:35 PM
Any one known VB 2005 compact framework sjar Visual Basic 2005 Basics 0 July 2nd, 2007 01:34 PM
compact framework - device emulator badgolfer .NET Framework 2.0 0 February 20th, 2007 06:45 PM
How use framework components in compact framework? r_bazghaleh C# 0 February 19th, 2006 05:05 AM
.Net Compact Framework Forum? Rissa Forum and Wrox.com Feedback 0 March 17th, 2004 05:28 PM

All times are GMT -4. The time now is 12:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.