Aggregating data and viewing with a chart

2 posts, 0 answers
  1. olepadre
    olepadre avatar
    8 posts
    Member since:
    Apr 2007

    Posted 27 Mar 2015 Link to this post

    I really want to try and use Rad HTML Chart for this, instead of just returning text.  it is a page to display Survey Responses.  Each response is a Likert Scale 1-4. I  need to display the averages of 7 questions in a single chart (because they are grouped similar questions)  Here's the problem.  Each question does have a "N/A" option which stores a NULL value in SQL so they are not calculated in the AVG or COUNT functions.

    Question 1: 14 Responses, with a 3.75 AVG
    Question 2: 12 Responses, with a 3.67 AVG
    Question 3: 14 Responses, with a 2.00 AVG
    Question 4: 13 Responses, with a 3.75 AVG
    Question 5: 10 Responses, with a 2.00 AVG

    I would like a single bar chart with each question a Column, showing the AVG, and the X-Axis label showing the # of responses per question that way we can justify the difference in number of responses.

    Does that all make sense?

    And here's my  problem; I don't know who to return the rows from SQL.  Do I return multiple rows and let ASP.NET do the AVERAGE and COUNT functions?  or do I make SQL do the calculations and only return 1 row with Col 1 = Question #1 COUNT, Col2 = Question #1 AVG, Col3 = Question #2 COUNT, Col4, Question #2 AVG, etc.

    Or do I return 2 datasets, one with AVG and one with COUNT?


  2. Danail Vasilev
    Danail Vasilev avatar
    1476 posts

    Posted 01 Apr 2015 Link to this post

    Hello Robert,

    In order to bind the chart each series as well as the x-axis labels should refer to the corresponding field from the data source. In your case you need two fields - one with responses for the x-axis and the other with average for the bar series.

    You can examine the data binding demos for more information on the matter.

    On a side note - the chart can only be bound to a single data source. You may also find useful this code library regarding manual data source grouping -

    Danail Vasilev

    See What's Next in App Development. Register for TelerikNEXT.

  3. DevCraft R3 2016 release webinar banner
Back to Top