Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Plotting with drawLines

Plotting with drawLines

Scheduled Pinned Locked Moved C#
graphicsperformancehelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bwagz
    wrote on last edited by
    #1

    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?

    D 1 Reply Last reply
    0
    • B bwagz

      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?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        B Offline
        B Offline
        bwagz
        wrote on last edited by
        #3

        The magnified portion is plotting a lissajous signal, so the display width isn't a factor. I thought about "skipping" datapoints, but wouldn't that misinterpret the data being displayed? Thanks for the reply

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups