title: Scaling Bar Chart Height With Data
body: <p>I am using the Microsoft Chart Control.</p>
  
  <p>I am trying to adjust the height of the chart area programmatically. Depending on the rows. Because the Microsoft Chart control requires a height, which cannot be in percentages, nor Auto. Depending on the selected query, the chart can have 1 bar or it can have 100's. This is why I need to adjust the height because bigger data sets appear squished and not readable.</p>
  
  <p>What I have tried is adding a counter <code>heightCounter</code> which is the number of bars on the chart.</p>
  
  <pre><code>        int newHeight = (heightCounter * 10);
  
          // Maximum height aloud on Chart Control
          if (newHeight &gt; 32767)
              newHeight = 32767;
  
          Chart1.Height = newHeight;
  </code></pre>
  
  <p>This sometimes works O.K. with smaller data sets
  <img src="https://i.stack.imgur.com/0Qv5y.png" alt="enter image description here"></p>
  
  <p>but when I have very large datasets the title looks very spaced out because the height is too large.</p>
  
  <p><img src="https://i.stack.imgur.com/2FVg8.png" alt="enter image description here"></p>
  
  <p>Is there a proper way to achieve this?</p>