title: Improving the performance of drawing a huge number of points with help of mschart component
body: <p>I am currently working on a windows forms application that has several modules. One of them is responsible for drawing generated simulation data. The idea of the plot is actually simple, but i am struggling to render the data efficiently.</p>
  
  <h3>So the questions i have are:</h3>
  
  <ol>
  <li>what is the best way to draw such a large amount of data?</li>
  <li>is drawing on a bitmap the right option?</li>
  <li>am i missing a basic .net framework or so that provides me with this functionality?</li>
  </ol>
  
  <p>The points to draw are provided as a list points in the form of (time, position), i.e. we have two axis.</p>
  
  <h3>I tried the following:</h3>
  
  <p>I tried drawing the points of all elevators all at once --> is resource intensive and the whole plot is redrawn on resize events. made two tests:<br></p>
  
  <ol>
  <li>draw the whole plot within a predefined viewport, but was not a good idea because the graph becomes messy.</li>
  <li>defined how many pixels for the time and position (e.g. 1 second = 1 pixel) and made the panel (picturebox inside it) scrollable. this worked better than the first option, but causes an outofmemory exception if the data is too large.</li>
  </ol>
  
  <h3>other possible approaches:</h3>
  
  <p>define a range for the drawing (e.g. timeRange = 10 mins) and let only that get painted. i imagine a problem with the scrolling, because i would have to redefine the starting point of the drawing (there where the range startpoint is) when the user scrolls.</p>
  
  <p>I would appreciate your help a lot and any suggestions, ideas, comments...etc.</p>
  
  <h3>Edit:</h3>
  
  <p>I tried the suggestions of <em>Patrick</em> and <em>TaW</em> regarding using <strong>MS Chart</strong>. Indeed it is a better and easier option as it is better programmed as my version so far. Though, i provided it of several series of data and i still suffer from performance issues. Namely, i have the <strong>following problems</strong>:</p>
  
  <ol>
  <li>it takes around a minitue to draw the data</li>
  <li>when zoomed-in (by enabling the corresponding properties, shown <a href="https://stackoverflow.com/questions/5141126/adding-a-scroll-bar-to-ms-chart-control-c-sharp">here</a> and the hint found <a href="https://stackoverflow.com/questions/4915854/c-sharp-chart-with-scrollbars">here</a>), scrolling becomes slow. It would be great if it could kinda flow or so...</li>
  <li>i am not able to or don't know how to zoom-out!</li>
  </ol>
  
  <p>Referring to the comment of <em>TaW</em> (see below) regarding the missing information about what i mean with large data - <strong>The simulation data to be drawn represent a time period of hours (e.g. 2-3 hours) and the should be viewable in intervals of 60s.</strong></p>
  
  <p>My <strong>Main Problem</strong> is the <strong>performance of the chart</strong>!</p>
  
  <p>Some diagnostic data that may help (used stopwatch to measure the DrawChart methode incl. its internal steps):</p>
  
  <ul>
  <li>chart1.Series.Clear() took: 00:00:00</li>
  <li>filling the chart1.Series.Add(...data..) took: 00:00:03.8230000</li>
  <li>configuring the chart1 took: 00:00:03.8240000</li>
  <li>plotView.DrawChart(points) took: 00:00:03.8290000</li>
  </ul>
  
  <p>That tells me that the drawing in the chart-module is what takes so long...</p>
  
  <p>Thanks for your help and time.</p>