Kendo Bar/Column Chart Series Name Remote Data

5 posts, 0 answers
  1. Rob
    Rob avatar
    2 posts
    Member since:
    Sep 2014

    Posted 22 Sep 2014 Link to this post

    I'm trying to get a chart to bind the series from a WebAPI call.  The data is coming back in the following json format.  Each object in the return should create one bar/column on the chart with the "Name" being the corresponding label/categoryAxis value.

    Thoughts?

    [{"Name":"Site1","Count":4,"Color":"#02bc84"},{"Name":"Site2","Count":3,"Color":"#f08080"}]
  2. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 23 Sep 2014 in reply to Rob Link to this post

    Hello Rob,

    Please try this one: http://dojo.telerik.com/@Holger/EQuB

    Regards,
    Holger
  3. Kendo UI is VS 2017 Ready
  4. Rob
    Rob avatar
    2 posts
    Member since:
    Sep 2014

    Posted 23 Sep 2014 Link to this post

    Thanks Holger!  That is what I'm looking for!  Is it possible to do this using the Fluent or MVC HTMLHelper as well?
  5. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 24 Sep 2014 Link to this post

    Hello Rob,

    I'm pretty sure it will be possible, but since I'm not using the ASP.NET MVC version of Kendo UI I cannot help you in this regard.

    Regards,
    Holger
  6. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 24 Sep 2014 Link to this post

    Hi,

    The MVC version of the sample provided by Holger will look similar to this:
    @(Html.Kendo().Chart<MyModel>()
        .DataSource(ds => ds.Read(read => read.Action("Read", "Data")))
        .Series(series => { series
            .Column(
                model => model.Count,
                colorExpression: model => model.Color)
            .Name("Count");
        })
        .CategoryAxis(axis => axis
            .Categories(model => model.Name)
        )
    )


    You can check out the remote data binding demo as well.

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready