app/controllers/surveyor_gui/reports_controller.rb
# stacked bar chart for a question group. categories = all answer_info in the group. bars = questions
stacked bar chart for a question group. categories = all answer_info in the group. bars = questions
stacked bar chart for a question group . categories = all answer_info in the group . bars = questions
def question_group_stacked_bar_chart(q_group, answer_info)
    questions = q_group.questions.reject(&:is_comment)
    categories = q_group.answers.map { |a| a.text }
    data_array = []
    questions.each do |q|
      q_data = chart_data_for_answer_info_in_q(answer_info, q)
      data_array << { name: q.text, data: q_data }
    end
    @chart[q.id.to_s] = chart_info :column_chart, data_array, { label: q.text, stacked: true }
  end
def question_group_stacked_bar_chart ( q_group , answer_info ) questions = q_group . questions . reject ( & :is_comment ) categories = q_group . answers . map { | a | a . text } data_array = [ ] questions . each do | q | q_data = chart_data_for_answer_info_in_q ( answer_info , q ) data_array << { name : q . text , data : q_data } end @chart [ q . id . to_s ] = chart_info :column_chart , data_array , { label : q . text , stacked : true } end
stacked bar chart for a question group.
stacked bar chart for a question group .
# StackOverflow answer: how to set up the data for chartkick stacked bar chart? # @see https://stackoverflow.com/a/24388877
q_group
answer_info