title: .NET Chart - Dynamic Value Labels
body: <p>I'm creating column charts using System.Web.UI.DataVisualization.Charting which have a variable number of series and X datapoint values.</p>
  
  <p>I can turn value labels on using:</p>
  
  <pre><code>myChart.Series[0].IsValueShownAsLabel = true;
  </code></pre>
  
  <p>Depending on how many series and datapoints there are however, these labels can become unreadable. Is there a way to have value labels but only if they are readable?</p>
  
  <p>A thought I had was along the lines of:</p>
  
  <pre><code>int datapointsCount = ?????;
  int labelPixelSize = 15;
  int chartPixelSize = ?????;
  
  if ((myChart.Series.Count * datapointsCount * labelPixelSize) &gt; chartPixelSize) {
      foreach (Series mySeries in myChart.Series) {
          mySeries.IsValueShownAsLabel = false;
      }
  }
  </code></pre>
  
  <p>This is pretty messy and far from ideal however.</p>
  
  <p>Thanks!! ;)</p>