I use Kendo 2015.1.429, MVC 4. I like change dinamically the text leyends in Kendo Chart column:
In my serie I have a text hat can change any time (2016 , 2017, etc):
First I have:
@(Html.Kendo().Chart<TestVM>()
.Name("ChartTest")
.Title("Montos")
.Legend(legend => legend.Position(ChartLegendPosition.Top))
...
.Series(series =>
{
series.Column(model => model.Monto1).Name("Monto 2015").Color("#6BD5C3");
series.Column(model => model.Monto2).Name("Monto 2014").Color("#7992BF");
})
But I like to make dinamically, It throw me an error when I use viewBag:
myView.cshtml
@{
var leyendaMonto1 = ViewBag.Monto1;
var leyendaMonto2 = ViewBag.Monto2;
}
series.Column(model => model.MontoAnio1).Name(@leyendaMonto1).Color("#6BD5C3");
model.MontoAnio1).Name(@leyendaMonto2).Color("#6BD5C3");
The error show:
Se produjo una excepción de tipo 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' en System.Core.dll pero no se controló en el código del usuario
Información adicional: La mejor coincidencia de método sobrecargado para 'Kendo.Mvc.UI.Fluent.ChartSeriesBuilderBase<Kendo.Mvc.UI.IChartBarSeries,Kendo.Mvc.UI.Fluent.ChartBarSeriesBuilder<TestVM>>.Name(string)' tiene algunos argumentos no válidos
Any help?