¿Cómo vinculan dos datos a Linechart en highcharts en MVC3? [duplicar]

Posible duplicado:
¿Cómo vincular datos al gráfico de líneas en gráficos altos en MVC3?

i have two procedure's in my entity frame work..and method to return data as json..how do i call these two procedure in my single method where i have to return these two procedures as a single json object .....and return this data to my .$getJson method in my jquery...can any tell me how to do this and that returned data should be binded to Linechart of highcharts as two separate lines cana ny one tell me how can i acheive this

   public ActionResult LoggedBugs()
    {
        return View();  
    }

    public JsonResult CreatedBugs()
    {
        int year;
        int month;
        int projectid;
        year=2012;
        month=8;
        projectid=16;
        var loggedbugs = db.ExecuteStoreQuery<LoggedBugs>("LoggedBugs @Year,@Month,@ProjectID", new SqlParameter("@Year", year), new SqlParameter("@Month", month), new SqlParameter("@ProjectID", projectid)).ToList();
        var ClosedBugs= db.ExecuteStoreQuery<ClosedBugs>("ClosedBugs @Year,@Month,@ProjectID", new SqlParameter("@Year", year), new SqlParameter("@Month", month), new SqlParameter("@ProjectID", projectid)).ToList();
        return Json(loggedbugs, JsonRequestBehavior.AllowGet);
    }

i want to return loggedbugs and Closedbugs as json object to my view and from there i have to bind this data to Linechart...where loggedbugs should have one line and Closedbugs should have other line ....expecting help here

preguntado el 28 de agosto de 12 a las 14:08

1 Respuestas

As always in an MVC application, start by defining a view model that will contain the information that your view requires (in your case that would be the list of logged and closed bugs):

public class BugsViewModel
{
    public string IEnumerable<LoggedBugs> LoggedBugs { get; set; }
    public string IEnumerable<ClosedBugs> ClosedBugs { get; set; }
}

and then have your controller action populate this view model that will be passed to the view:

public ActionResult CreatedBugs()
{
    var year = 2012;
    var month = 8;
    var projectid = 16;
    var loggedbugs = db.ExecuteStoreQuery<LoggedBugs>("LoggedBugs @Year,@Month,@ProjectID", new SqlParameter("@Year", year), new SqlParameter("@Month", month), new SqlParameter("@ProjectID", projectid)).ToList();
    var closedBugs = db.ExecuteStoreQuery<ClosedBugs>("ClosedBugs @Year,@Month,@ProjectID", new SqlParameter("@Year", year), new SqlParameter("@Month", month), new SqlParameter("@ProjectID", projectid)).ToList();
    var model = new BugsViewModel
    {
        LoggedBugs = loggedBugs,
        ClosedBugs = closedBug
    };
    return Json(model, JsonRequestBehavior.AllowGet);
}

Respondido 28 ago 12, 14:08

then how will i show this data in my line chart..how do i manipulate this data to show in my line chart..where LoggedBugs should have a separate line and ClosedBugs should have a separate line - SoftwareNerd

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.