Home forums Using CanvasJS Display Chart using JSON data in ASP MVC Reply To: Display Chart using JSON data in ASP MVC

#6486

lonwabogiqwa
Participant

Hi, sorry i am a beginner with this. i now want to display project data in a line graph like a multiline series or single line using the same script you show above but i seem to have a problem with date and the graph is not displaying. i want to display a chart that can show project status versus completion date. my controller looks like this:

namespace ChartDemo.Controllers
{
public class DashboardController : Controller
{
//
// GET: /Dashboard/
public ActionResult Index()
{
return View();
}
public ContentResult GetData()
{
using (var db = new QualityMatricsEntities1())
{
var result = (from tags in db.Projects
orderby tags.CompletionDate ascending
select new { tags.CompletionDate, tags.ProjectStatus,tags.ProjectName }).ToList();
//return Json(JsonConvert.SerializeObject(result), JsonRequestBehavior.AllowGet);
return Content(JsonConvert.SerializeObject(result), “application/json”);

}
}

}
}