title: Use SQL data for flot chart with C# and ASP
body: <p>I am new to flot charts and more a SQL guy than a C# programmer.  I am attempting to have a bar chart reflect monthly sales.  I can't seem to get my data through to the chart.  I have been searching all over for a direct answer on getting this to work and have had zero luck after 4 days.  Here is what the stored procedure returns:</p>
  
  <pre><code>MonthID SoldCount   MonthName
  4        101         Apr
  8        118         Aug
  2        74          Feb
  1        74          Jan
  7        113         Jul
  6        126         Jun
  3        114         Mar
  5        129         May
  9         47         Sep
  </code></pre>
  
  <p>Here is my code behind</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data;
  using System.Data.SqlClient;
  using System.Text;
  using System.Configuration;
  using SkywebReporter.Classes;
  
  namespace SkywebReporter
  {
      public partial class DefaultObject : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {         
          }
          string conn = ConfigurationManager.ConnectionStrings["sqlConn"].ConnectionString;
          [System.Web.Services.WebMethod]//public static web method in code behind
          public static List&lt;PNMACsales&gt; GetData() //int StartRowindex, 
          {
              List&lt;PNMACsales&gt; myResult = new List&lt;PNMACsales&gt;();
              using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlConn"].ConnectionString))
              {
                  //string sqlString = "SelectbyYearTotalProductAssign";
                  string sqlString = "PNMAC.procReportSalesCounts";
                  using (SqlCommand cmd = new SqlCommand(sqlString, conn))
                  {
                      cmd.CommandType = System.Data.CommandType.StoredProcedure;
                      conn.Open();
                      SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                      while (rdr.Read())
                      {
                          PNMACsales obj = new PNMACsales();
                          obj.SoldCount = Convert.ToInt32(rdr["SoldCount"]);
                          obj.MonthName = rdr["MonthName"].ToString();
                          myResult.Add(obj);
                      }
                      conn.Close();
                  }
              } 
              return myResult;             
          }      
      }
  }
  </code></pre>
  
  <p>This is my JS file Dashboard.js</p>
  
  <pre><code>function DrowChart() {
      jQuery("#placeholder").html('');
      var list12 = [];
      jQuery.ajax({
          type: "POST",
          url: "DefaultObject.aspx/GetData",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          async: false,
          data: "{}",
          success: function (data) {
              jQuery.map(data.d, function (item) {
                  var list = [];
                  list.push("'" + item.MonthName + "'");
                  list.push(item.SoldCount);
                  list12.push(list);
              });
              var plot1 = jQuery.jqplot('chart1', [list12],
  
                                       );
          }
      });
  }
  </code></pre>