I have a controller with Two Actions and a View with Two Charts, the first one is directly on the View and the second is a Partial View, such below:
<div class="chart" style="margin-top: 10px;"> @(Html.Telerik().Chart(Model) .Name("CustomerCount") .Title(title => title.Text("TotalCustomersPerHour")) .Legend(settings => settings.Position(ChartLegendPosition.Bottom)) .Series(series => series.Line(p => p.CustomerCount.Total).Name("TotalCustomersPerHour")) .CategoryAxis(a => a.Categories(p => p.CustomerCount.Intervalo).Labels(l => l.Rotation(-40))).Theme("vista") .Tooltip(true) .HtmlAttributes(new { style = "height: 300px;" }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("CustomerCountData", "Indicators", new { storeId = "TR_001", startDate = DateTime.Today, endDate = DateTime.Today.AddDays(10) })) .ClientEvents(b => b.OnDataBound("OnCustomerCountDataBound")) ) </div> <div class="chart" style="margin-top: 10px;"> @Html.Partial("_ChartTest") </div> The first Action is called by a Telerik Chart Ajax calling, when its done I call the another Action by OnDataBound event in order to populate my Partial View Chart using ViewBags.
function OnCustomerCountDataBound(e) { $.ajax({ type: "POST", url: "Indicators/ChartTest", data: { retailStoreId: "TR_001"}, }); } I debugged the Partial view and I can get the ViewBag values but the result is not shown on the Page.
@(Html.Telerik().Chart() .Name("TimeOfPermanency") .Title(title => title.Text(TrackerMessages.TimeOfPermanencyPerArea)) .Legend(settings => settings.Position(ChartLegendPosition.Bottom)) .Series(series => { if (ViewBag.Series != null) { foreach (var area in ViewBag.Series) { series.Column(area.Data).Name(area.Name); } } }) .CategoryAxis(axis => { if (ViewBag.Categories != null) { axis.Categories(ViewBag.Categories); } }) .Tooltip(true) .HtmlAttributes(new { style = "height: 300px;" }) .ClientEvents(b => b.OnDataBound("OnTimeOfPermanency")) ) Anyone knows why the results are not rendering on my second chart?
Thanks!