Hi,
I've created a Scatter chart in ASP.NET MVC with the code below:
The above is calling a method in the Products controller below:
The chart will refresh when a new country is selected by the script below:
However, the page will freeze at times due to a "long running script". The DataSource of the chart calls the action GetProductsCountByCountry and groups the data. I want to do the grouping on the server side but I'm not sure how to change the code for my chart for dynamic series without doing what I'm currently doing.
This is the first time I'm using Kendo DataViz and I really could use some help.
Thanks!
I've created a Scatter chart in ASP.NET MVC with the code below:
@(Html.Kendo().Chart<GIPM.DAL.ViewModels.ProductsCountByCountryYear>()
.Name(
"linechart"
)
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.DataSource(ds => ds
.Read(read => read.Action(
"GetProductsCountByCountry"
,
"Products"
,
new
{ country =
""
}))
.Group(group => group.Add(model => model.Country))
.Sort(sort => sort.Add(model => model.Year).Ascending())
)
.Series(series =>
{
series.ScatterLine(model => model.Year, model => model.Count)
.Name(
"Country"
)
.GroupNameTemplate(
"#= group.value #"
);
})
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.YAxis(axis => axis.Numeric()
.Labels(labels => labels
.Format(
"{0}"
)
)
.MajorUnit(1)
)
.XAxis(axis => axis.Date()
.Labels(labels => labels.Format(
"{0}"
))
.MajorUnit(1)
)
)
public
ActionResult GetProductsCountByCountry(
string
country
)
{var query = _customsService.GetExportSeizedCountByCountry(country);
return
Json(query, JsonRequestBehavior.AllowGet);
}$(
"#chart"
).data(
"kendoChart"
).dataSource.read({ country: strcountry
});
However, the page will freeze at times due to a "long running script". The DataSource of the chart calls the action GetProductsCountByCountry and groups the data. I want to do the grouping on the server side but I'm not sure how to change the code for my chart for dynamic series without doing what I'm currently doing.
This is the first time I'm using Kendo DataViz and I really could use some help.
Thanks!