CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    1

    [HELP] Plotting readings on graph dynamically

    Hi,

    I am writing an application that can sense the surrounding temperature.

    I am thinking to plot the different temperature readings through a dynamic graph(if this is the correct term), every few seconds or even 1 minute.
    Like for eg, 3.47pm, temperature reading is 27 degrees, 3.48pm is 28 degrees. 3.49pm is 28.5 degrees and so on and so forth...
    The graph will be able to display the temperature (perhaps on the y axis) while the time on the x-axis.

    Could anyone give me advise on this? I tried searching on Google but mostly I found are those that are cos/sin graphs.

    Thanks,
    Daniel

    ps: I am using framework 3.5

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: [HELP] Plotting readings on graph dynamically

    I've done some plotting of ECG's before, however in my case I had all of the data up front. I created and Image on the fly and then obtained it's Graphics and plotted the data accordingly. Then saved the image to a file for displaying on a web page.

    Off the top of my head, I suggest your form has a picture box with an initial image that maybe just contains a grid and each 'minute' you obtain the image, get it's Graphics, plot the new point and then Invalidate() the PictureBox.

    If you know how many minutes fit on the Image, you could keep a buffer of previous values and then each time around, completely replot the image before the invalidate. This may give the illusion of the plot moving right to left. If you decide to do this more rapidly, check out the DoubleBuffer... property.

    I can post a bit of code on Monday, just don't have my Dev machine here right now!
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured