Using this link: https://docs.telerik.com/aspnet-mvc/helpers/chart/how-to/create-dynamic-series#create-view-model-bound-dynamic-series
I managed to get a working chart with multiple series, but I can't get the category names at the same time. From the link it appears that I should be able to provide an IEnumerable (or something?) to give the list of category names (see the commented part in the code I provide below) but when I do this I just get [object] as the result. The data type is a List<string>.
@(Html.Kendo().Chart(Model.ApplicationStepsByDayResults.ValuesForLineChart)
.Name("applicationStepsByDay")
.Legend(legend => legend.Visible(true))
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Line().Style(ChartLineStyle.Smooth)
)
.CategoryAxis(axis => axis
.Categories(Model.ApplicationStepsByDayResults.CategoryNames) // <- from example looks like I can add names here
.MajorGridLines(lines => lines.Visible(false))
)
.Series(series =>
{
foreach(var s in Model.ApplicationStepsByDayResults.ValuesForLineChart)
{
series.Line(s.Points).Name(s.Name);
}
})
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0}"))
.Line(lines => lines.Visible(false))
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Shared(true)
.Format("{0}")
)
)
I am not sure how to use the .Categories(a => a.Categories.... to insert the category names when they are dynamic.
As a side note I can get the category names to appear is I create a field for it for each series point and use the .CategoryField(xxx) function when setting up the series but then I lose the data points.
One last question, I would love to be able to see the docs for these functions. Visual studio indicates there are overloads but the UI does not provide them and I can't find any docs on the telerik site. It would be easier to sort this out on my own if there was documentation for the MVC helper methods.
Thanks,
Brian