I have 2 charts that I'm defining using the mvc wrappers. They both operate on the same data, which I'm loading using Ajax binding. So that they do not make 2 separate calls I wanted to define a shared dataSource, but I've been unable to figure out how to do this when the charts are defined using MVC. Here's a cut down version of my chart definitions.
Is there a way to define a shared dataSource in MVC alone? if not is there a sensible way to do it in javascript? (I tried assigning the datasource from one grid to another in a javascript event, but this only seemed to work properly the 2nd time the event occurred. I also tried doing it in jquery document.ready, but the charts don't seem to have been created at that point.
@(Html.Kendo().Chart<
OtpDelayStat
>()
.Name("OtpBreakdown")
.DataSource(ds => ds.Read(r => r.Action("GetOtpBreakdown", "Reports").Data("OtpBreakdownData")))
.Series(series =>
{
series.Column(m => m.OutDelay).Name("Out Delay").Color("#F93");
})
)
@(Html.Kendo().Chart<
Collins.Hermes.WebMessenger.Models.Reports.OtpDelayStat
>()
.Name("OtpBreakdown2")
.Series(series =>
{
series.Column(m => m.ScheduledLength).Name("Schedule").Stack("Scheduled Times").Color("#090");
series.Column(m => m.OnTimeArrival).Name("On-Time Arrival").Stack("Scheduled Times").Color("#090").Opacity(0.5);
})
)
Is there a way to define a shared dataSource in MVC alone? if not is there a sensible way to do it in javascript? (I tried assigning the datasource from one grid to another in a javascript event, but this only seemed to work properly the 2nd time the event occurred. I also tried doing it in jquery document.ready, but the charts don't seem to have been created at that point.