Plotting with drawLines
-
The program I'm creating allows a user to scroll through a waveform consisting of 10,000+ data points. As the user scrolls through the waveform, a magnified portion of it is displayed on another area of the screen. The magnified portion can plot anywhere from 0 to the entire length of the waveform's points. Right now I'm having a major refresh slow down when the number of data points for the magnified portion is too large. To plot all of the points I'm using the Graphics.DrawLines() method. To help the performance I also added a Timer (50ms) to limit the number of Invalidate()'s when the user is scrolling, which helps a little bit. I tried drawing the magnified portion with an offscreen memory bitmap, but it didn't really me. Can direct draw help me with this in any way?
-
The program I'm creating allows a user to scroll through a waveform consisting of 10,000+ data points. As the user scrolls through the waveform, a magnified portion of it is displayed on another area of the screen. The magnified portion can plot anywhere from 0 to the entire length of the waveform's points. Right now I'm having a major refresh slow down when the number of data points for the magnified portion is too large. To plot all of the points I'm using the Graphics.DrawLines() method. To help the performance I also added a Timer (50ms) to limit the number of Invalidate()'s when the user is scrolling, which helps a little bit. I tried drawing the magnified portion with an offscreen memory bitmap, but it didn't really me. Can direct draw help me with this in any way?
Well, you can only plot as many points as the width of your display window for this graph, which is what? 1024 points at most? If you show all 10,000 points, your overdrawing the same column of pixels 10 times before moving to the next one. Figure out how wide your client window is, this will be the number of datapoints you can show. Then do a little math to figure out how many datapoints to skip between adjacent pixels. For example, you'll only look at every 25th datapoint when plotting your graph. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Well, you can only plot as many points as the width of your display window for this graph, which is what? 1024 points at most? If you show all 10,000 points, your overdrawing the same column of pixels 10 times before moving to the next one. Figure out how wide your client window is, this will be the number of datapoints you can show. Then do a little math to figure out how many datapoints to skip between adjacent pixels. For example, you'll only look at every 25th datapoint when plotting your graph. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome