In all of the examples I have seen, lets just take an area chart for example, the data sent to the chart is a simple list of values. So for instance you have the ElectricityProduction class with data points for Solar, Hydro, etc and the category (Year) is sent with it. The chart then is defined as:
@(Html.Kendo().Chart<
Kendo.Mvc.Examples.Models.ElectricityProduction
>()
The datasource is defined as:
.DataSource(ds => ds.Read(read => read.Action("_SpainElectricityProduction", "Area_Charts")))
The action returns a collection of ElectricityProduction objects.
I am trying to use the following class that has a property which is a collection of data points and then another property with the points I want on the x-Axis. In my case there can be a thousand points but I don't want to show a thousand ticks on my graph. I want to be able to customize which points I use for tick mark. So my class is as follows:
public class DailyPerformanceChart
{
private List<
string
> _months;
public List<
AccountRunningPerformance
> RunningPerformanceValues;
public List<
string
> MonthsForAxis {
get
{
return _months;
}
}
}
public class AccountRunningPerformance
{
public string Date {get; set;}
public decimal Value{ get; set; }
}
My Kendo Chart is defined as:
@(Html.Kendo().Chart<
DailyPerformanceChart
>()
.Name("chartRunningPerformance")
.Title("Growth of $10k")
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Area().Line(line => line.Style(ChartAreaStyle.Smooth))
)
.DataSource(ds => ds.Read(read => read.Action("RunningPerformanceData", "Account").Data("sendAccountID")))
.Series(series =>
{
series.Area(model => model.RunningPerformanceValues).Name("Account").CategoryField("Date");
})
)
So the read action returns a DailyPerformanceChart filled with a collection of plot points (RunningPerformanceValues) and a collection of Dates to plot on x-axis (MonthsForXAxis).
What I can't figure out is how to code the series to look at model.RunningPerformanceValues as the plot points, using Date as X and value as Y and then setting the CategoryAxis to use the model.MonthsForAxis.
Hopefully this is enough information to explain my issue.