Results 1 to 2 of 2

Thread: Continuous Scrolling Graph

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Posts
    6
    I'm trying to create a continuous scrolling graph. I'm reading in data, ploting it on a picture box, and scrolling the picture box as the data reaches the right edge. After all the data is taken, I want to be able to scroll the graph back to the beginning (and to points inbetween). Using BitBlt copies over the old lines. If I use 2 Picture Boxes, one inside the other, then the old lines get erased as they move past the edge of the other box. Is there a way to make a scrolling graph and preserve the early lines?

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    I have never tried

    I assume you are plotting the line in your own code and not using some custom control to do it.

    I belive that your best course of action is to record the data points in an array so that you can redraw it later. this also allows other actions such as dumping the data to disk, and zooming in /out on the graph whereas relying on BitBlt doesn't.

    In your outline, it looks to me like you are really just using the picturebox as a storage area as well as the visual display area. I believe this is far more memory hungry than having arrays to store the coordinates of the points.

    Remember that a the biggest part of a bitmap is basically a 2D matrix of bytes. Do you really want to store all that data in the picturebox, even if you could find a way to do it? If it were possible (and like I said, I haven't tried so don't know) you could end up with a bitmap that is thousands of pixels wide! I am not sure such a bitmap is wise Microsoft might have said something like "10,000 pixels wide is enough for anyone!" when designing Vb (hehe).

    Stick to a generic method to re-plot your graph each time you want it. Make the method take a starting point and ending point or maybe just a "must see" point. The mehod will redraw the graph so you can see exactly what you want to see.

    Furthermore, you could have several pictureboxes showing the same data but in different ways. For example, one shows the real-time data while another shows historical data (i.e. you can see the live data coming in while scrolling back on another picturebox).

    I believe it would be a far better investment of your time and energy, rather than worry about BitBlt.

    Hope I have convinced you

    Regards
    Paul Lewis

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