Hi,
I'm using databinding on a line chart. I want to display multiple serie so i write this code :
this
.ChartBuilder = htmlHelper.Kendo().Chart<SerieValueViewModel>()
.Name(Guid.NewGuid().ToString())
.Title(
this
.Name)
.DataSource(dataSource =>
{
dataSource.Read(read => read
.Action(
this
.DataSourceViewModel.View,
this
.DataSourceViewModel.Action))
.Group(group => group.Add(m => m.Symbol))
.Sort(s => s.Add(m => m.Date).Ascending());
})
.Series(series =>
{
series.Line(v => v.Value, v => v.Date)
.Name(
"#= group.value #"
)
.Aggregate(
this
.CategoryAxisViewModel.Aggregation)
.Stack(
false
)
.Markers(m => m.Visible(
true
).Size(3));
});
}
Now, i want to display a color to my serie. But this color depend of my serie and i only have a list of value that i've grouped.
I tried to use a new object named SerieViewModel which contains List of SerieValueViewModel and a color and do something like this...
this
.ChartBuilder = htmlHelper.Kendo().Chart<SerieViewModel>()
.Name(Guid.NewGuid().ToString())
.Title(
this
.Name)
.DataSource(dataSource =>
{
dataSource.Read(read => read
.Action(
this
.DataSourceViewModel.View,
this
.DataSourceViewModel.Action));
})
.Series(series =>
{
// I want to do something like this ...
// Get my serieViewModel which is iterate
var mySerie = iterateObject;
foreach
(var valueViewModel
in
mySerie.ValueViewModelCollection)
{
series.Line(valueViewModel => valueViewModel.Value, valueViewModel => valueViewModel.Date)
.Name(mySerie.Name)
.Aggregate(
this
.CategoryAxisViewModel.Aggregation)
.Stack(
false
)
.Markers(m => m.Visible(
true
).Size(3))
.Color(mySerie.Color);
}
});
}
This is exactly what i need but i can't get my serieViewModel which is actually iterate, so i can't bind my values and use my color.
I want to use this reflection to put a "serieType" in my serieViewModel object too and construct charts with different series type like a chart with a line and an area.
There is a way to get my object which is iterate or get some of his properties ?
Thanks