Binding line series to Array/List

2 posts, 0 answers
  1. Andrey
    Andrey avatar
    8 posts
    Member since:
    Aug 2012

    Posted 30 Aug 2012 Link to this post

    Hi, 
    I have my model described like: 
        public class PerformanceChartSeriesModel_2
        {
            public string[] Date { get; set; }
            public double[] P1 { get; set; }
        }

    Now, I chart :
        @(Html.Kendo().Chart<PerformanceChartSeriesModel_2>()
            .Name("chartPerformance")        
            .Legend(legend => legend
            .Position(ChartLegendPosition.Bottom)
            )
            .DataSource(ds => ds
                .Read(read => read.Action("PerformanceChartData", "Performance").Data("performanceChartData"))
            )
           .Series(series =>
           {
               series.Line(p=>p.P1);                      
           })
                   .CategoryAxis(axis =>
                   {
                       axis.Categories(l => l.Date);
                   })   

    Neither series nor categories pick up values, series actually behave in a strange way drawing only one point.
    Could you tell what is wrong, or how can I work with such model.
    Thanks.
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 03 Sep 2012 Link to this post

    Hello Andrey Dorokhov,

    As you can see in our offline example line-charts/remote-data you need to pass an array with objects. Then you need to specify the bindable field.

    If you want to pass an array to the series you can do this with ViewBag or Model.Something.

    Kind regards,
    Hristo Germanov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top