title: How to chart using Web.UI.DataVisualization.Charting?
body: <p><code>using System.Web.UI.DataVisualization.Charting.Chart</code></p>
  
  <p>I have data in 2 formats:<br>
  A. <a href="https://i.stack.imgur.com/7jeUs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7jeUs.png" alt="Vertical format data"></a>  </p>
  
  <p>B. <a href="https://i.stack.imgur.com/FTIJF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FTIJF.png" alt="Horizontal format data"></a></p>
  
  <p>The data in format <strong>A</strong> is what I am using to build a chart. But my chart ends up looking like:
  <a href="https://i.stack.imgur.com/6plXU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6plXU.png" alt="sample chart"></a></p>
  
  <p>I cannot figure out how come no lines are drawn. Here is the code I am using:</p>
  
  <pre><code>var dataTable = GetDataTable();
  var xAxisTitle = dataTable.Columns[1].ExtendedProperties["Type"].ToString();
  var yAxisTitle = dataTable.Columns[0].ExtendedProperties["Type"].ToString();
  
  chart = new Chart() {
      AntiAliasing = AntiAliasingStyles.All,
      TextAntiAliasingQuality = TextAntiAliasingQuality.High,
      Width = 1200,
      Height = 800,
      Enabled = true,
      ForeColor = Color.SaddleBrown
  };
  
  var chartArea = new ChartArea() {
      BackColor = Color.White,
  
      AxisY = new Axis() {
          Enabled = AxisEnabled.True,
          Title = yAxisTitle,
          LineColor = Color.DarkBlue,
          MajorTickMark = new TickMark() {
              Enabled = true,
              LineColor = Color.DarkGreen,
              Interval = .1d
          },
          MinorTickMark = new TickMark() {
              Enabled = true,
              LineColor = Color.Green,
              Interval = .1d
          },
          LabelStyle = new LabelStyle() {
              Enabled = true,
              ForeColor = Color.Red,
              IsEndLabelVisible = true,
              Font = new Font("Calibri", 4, FontStyle.Regular)
          },
          MajorGrid = new Grid() {
              Enabled = true,
              LineColor = Color.LightGray,
              LineWidth = 1
          },
      },
  
      AxisX = new Axis() {
          Enabled = AxisEnabled.True,
          Title = xAxisTitle,
          LineColor = Color.DarkBlue,
          MajorTickMark = new TickMark() {
              Enabled = true,
              LineColor = Color.Red,
              Interval = .1d
          },
          MinorTickMark = new TickMark() {
              Enabled = true,
              LineColor = Color.DarkGreen,
              Interval = .1d
          },
          LabelStyle = new LabelStyle() {
              Enabled = true,
              ForeColor = Color.Blue,
              IsEndLabelVisible = true,
              Font = new Font("Calibri", 4, FontStyle.Regular)
          },
          MajorGrid = new Grid() {
              Enabled = true,
              LineColor = Color.DarkGray,
              LineWidth = 1
          },
      },
  };
  
  chartArea.AxisX.Enabled = AxisEnabled.True;
  chartArea.AxisY.Enabled = AxisEnabled.True;
  chart.ChartAreas.Add(chartArea);
  
  var lineHeaders = dataTable.Rows
      .OfType&lt;DataRow&gt;()
      .Select(r =&gt; r[0].ToString())
      .ToArray();
  
  var i = 0;
  for (int column = 0; column &lt; lineHeaders.Length; column++) {
      var header = lineHeaders[column];
  
      var series = chart.Series[header] = new Series() {
          Enabled = true,
          Name = header,
          Font = new Font("Lucida Sans Unicode", 6f),
          Color = legendColors[header],
          ChartType = SeriesChartType.Line,
          XValueType = ChartValueType.DateTime,
          YValueType = ChartValueType.Double,
      };
  
      var colData = dataTable.Rows[column]
          .ItemArray
          .Skip(1)
          .Select(d =&gt; (double)d)
          .ToArray();
  
      DataPoint p = new DataPoint() {
          AxisLabel = header,
          XValue = i++,
          YValues = colData,
      };
  
      series.Points.Add(p);
  }
  </code></pre>
  
  <p>I've also set the data table as the data source on the <code>Chart</code> but there are no data points plotted.</p>
  
  <p>Am I even using the correct data table ...should I be using format <strong>B</strong> instead?</p>