Dynamic CategoryAxis for MVC Kendo Chart

2 posts, 0 answers
  1. Richard
    Richard avatar
    9 posts
    Member since:
    Jun 2016

    Posted 25 May 2017 Link to this post

    Hello,  currently i have this and it works great..   What i need is for the Categories in CategoryAxis to be dynamicand not the static .Categories("1", "2", "3", "4", "5")..       

    I already have the value i want to put in there coming from my model,  its "@item.SurveyLinearCounts.FirstOrDefault().Min"   for the minimum value  and  @item.SurveyLinearCounts.FirstOrDefault().Max"   for the maximum

       How do i do this.?

                                      .Legend(legend => legend
                                      .ChartArea(chartArea => chartArea
                                      .Series(series =>
                                          series.Column(model => model.ResponseCount).Name("Count").Tooltip(tooltip => tooltip.Visible(true).Template("#= series.name #: #=  value #"));
                                       .CategoryAxis(axis => axis
                                          .Categories("1", "2", "3", "4", "5")
                                          .MajorGridLines(lines => lines.Visible(false))
                                      .ValueAxis(axis => axis
                                          .Line(line => line.Visible(false))
                                          .MajorGridLines(lines => lines.Visible(true))
                                      .DataSource(ds => ds
                                          .Read(read => read.Action("GetSurveyResponseChart", "DataSource", new { item.SurveyQuestionID })))
                                      .Tooltip(tooltip => tooltip.Visible(true).Template("#= series.name #: #= value #")))
  2. Alex Hajigeorgieva
    Alex Hajigeorgieva avatar
    992 posts

    Posted 29 May 2017 Link to this post

    Hello Richard,

    If possible, I suggest adding a Categories model property.

    We have a How-to article which shows binding to dynamic series that you may find useful:


    Let me know if you need more help.

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 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