Binding line series to Array/List

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

    Posted 30 Aug 2012 Link to this post

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

    Now, I chart :
            .Legend(legend => legend
            .DataSource(ds => ds
                .Read(read => read.Action("PerformanceChartData", "Performance").Data("performanceChartData"))
           .Series(series =>
                   .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.
  2. Hristo Germanov
    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. Attila
    Attila avatar
    21 posts
    Member since:
    Oct 2016

    Posted 06 Oct 2017 in reply to Andrey Link to this post


    Can you show me the PerformanceChartData action of your Performance controller? I'm facing similar problem and try to find some solution... My action returns with Json(res.ToDataSourceResult(request)), where res is IEnumerable<MyClass>.


    Many thanks

  4. Stefan
    Stefan avatar
    1587 posts

    Posted 11 Oct 2017 Link to this post

    Hello, Attila,

    In general, the Action should return an array of objects as Hristo suggested.

    Please inspect the response from the server when the data is returned with "Json(res.ToDataSourceResult(request))"

    The expected result can be observed in our demo:

    Please have in mind that this is an old thread and there is a big chance Andrey to not have the code available as this was 5 years ago.

    If there is a specific issue, please provide more details or runnable example and we will gladly assist.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top