How to add google chart api data asp.net?

How to add google chart api data asp.net? 


i want to create created a graph with the help of google chart api and I have a problem with correct display name of the month on the chart 
this is  code in controller looks like:

public ActionResult ListOrder()
    {
        var result = from s in db.Orders.ToList()
                     group s by
          new { Year = s.dateCreated.Year, Month = s.dateCreated.Month, Day = 1 }
             into g
        select new OrderViewModel
          {
        dateCreated = new DateTime(g.Key.Year, g.Key.Month, g.Key.Day),
        TotalPrice = g.Sum(x => x.totalPrice)
          };
        return Json(result, JsonRequestBehavior.AllowGet);


// change column data type to 'date'
data.addColumn('date', 'Month');
data.addColumn('number', 'Total sum order for month');

for (var i = 0; i < chartData.length; i++) {
    var rowDate;

    // convert dateCreated
    rowDate = chartData[i].dateCreated;

    // replace first forward slash (/) with 'new'
    rowDate = rowDate.replace('/', 'new ');

    // remove second forward slash (/)
    rowDate = rowDate.replace('/', '');

    // evaluate the string to an actual date
    rowDate = eval(rowDate);

    data.addRow([rowDate, chartData[i].TotalPrice]);
}




Sql Server Interview Qus:


Comments