Hai. So, I have view and I loaded column chart on this view like partial view(chart diagram). And I have a little problem, I can't to send data from controller. I need to load data after sorting data. I send service id and after that, loading chart with data only for this service.
Load main view => send data in controller with service id => in contoller do query for database => load data in partial chart view => display partial view chart data in main view
//Partial view@Html.Partial("~/Views/Graphs/TableStatementsChart.cshtml", new ViewDataDictionary { { "Id", Model.servicesModel.Id } })//contollerpublic ActionResult TableStatementsChart(int Id) { ViewBag.IdService = Id; return View("~/Views/Graphs/TableStatementsChart.cshtml"); } [HttpPost] public ActionResult TableStatements_Read(int Id) { int localId = Id; return Json(db.TableStatements.Select(tableStatements => new { fkIdServices = tableStatements.fkIdServices, Month = tableStatements.Month, Count = tableStatements.Count, DoneCount = tableStatements.DoneCount, TopicalCount = tableStatements.TopicalCount }).Where(x=>x.fkIdServices == Id)); }//Chart diagram@{ Layout = "~/Views/Shared/_LayoutKendoUIChart.cshtml";}@(Html.Kendo().Chart<NarkomApp.Models.TableStatements>() .Name("chart") .Title("Заявки") .Legend(legend => legend.Position(ChartLegendPosition.Bottom)) .Tooltip(tooltip => tooltip.Visible(true)) .DataSource(ds => ds.Read(read => read.Action("TableStatements_Read", "TableStatementsChart"))) .Series(series => { series.Column(a => a.Count).Name("Общее").Color("red"); series.Column(a => a.DoneCount).Name("Выполненные").Color("blue"); series.Column(a => a.TopicalCount).Name("Актуальные").Color("green"); }) .CategoryAxis(axis => axis .Categories(model => model.Month).Labels(labels => labels.Rotation(-90))))
