changed export sheet title and also fixed issue in chart rendering in result page
This commit is contained in:
		
							parent
							
								
									5de4fd7777
								
							
						
					
					
						commit
						2c9c57287f
					
				|  | @ -1,7 +1,7 @@ | ||||||
| # encoding: utf-8 | # encoding: utf-8 | ||||||
| 
 | 
 | ||||||
| wb = xlsx_package.workbook | wb = xlsx_package.workbook | ||||||
| wb.add_worksheet(name: @survey.title) do |sheet| | wb.add_worksheet(name: @survey.title[0..15]) do |sheet| | ||||||
| 
 | 
 | ||||||
|   row = [] |   row = [] | ||||||
|   @survey_questions.each_with_index do |question, i| |   @survey_questions.each_with_index do |question, i| | ||||||
|  |  | ||||||
|  | @ -25,9 +25,9 @@ | ||||||
|                 <div id="question_chart_<%= question.id.to_s %>" style="width: 600px; height: 300px;"></div> |                 <div id="question_chart_<%= question.id.to_s %>" style="width: 600px; height: 300px;"></div> | ||||||
|               </li> |               </li> | ||||||
|             <% when SurveyQuestion::Radiogroup %> |             <% when SurveyQuestion::Radiogroup %> | ||||||
|               <% question.survey_question_options.each do |option| %> |               <% question.survey_question_options.each_with_index do |option,index| %> | ||||||
|                 <li> |                 <li> | ||||||
|                   <div id="question_chart_<%= question.id.to_s %>_<%= option.id.to_s %>" style="width: 600px; height: 300px;"></div> |                   <div id="question_chart_<%= question.id.to_s %>_<%= index.to_s %>" style="width: 600px; height: 300px;"></div> | ||||||
|                 </li> |                 </li> | ||||||
|               <% end %> |               <% end %> | ||||||
|             <% end %> |             <% end %> | ||||||
|  | @ -57,15 +57,17 @@ | ||||||
|           chart_<%= qid %>.draw(data_<%= qid %>, {title: '<%= question.title %>'}); |           chart_<%= qid %>.draw(data_<%= qid %>, {title: '<%= question.title %>'}); | ||||||
|         <% when ::SurveyQuestion::Radiogroup %> |         <% when ::SurveyQuestion::Radiogroup %> | ||||||
|           <% options = Hash[question.survey_question_options.collect{|o| [ o.id.to_s, o.name ] }] %> |           <% options = Hash[question.survey_question_options.collect{|o| [ o.id.to_s, o.name ] }] %> | ||||||
|  |           <% i = 0 %> | ||||||
|           <% @chart_data[qid].each do |option, groups| %> |           <% @chart_data[qid].each do |option, groups| %> | ||||||
|             var data_<%= qid %>_<%= option %> = google.visualization.arrayToDataTable([ |             var data_<%= qid %> = google.visualization.arrayToDataTable([ | ||||||
|               ['<%= t("survey_question.option") %>', ''], |               ['<%= t("survey_question.option") %>', ''], | ||||||
|               <% groups.each do |group, count| %> |               <% groups.each do |group, count| %> | ||||||
|                 ['<%= group %>', <%= count %>], |                 ['<%= group %>', <%= count %>], | ||||||
|               <% end %> |               <% end %> | ||||||
|             ]); |             ]); | ||||||
|             var chart_<%= qid %>_<%= option %> = new google.visualization.PieChart(document.getElementById('question_chart_<%= qid %>_<%= option %>')); |             var chart_xx = new google.visualization.PieChart(document.getElementById('question_chart_<%= qid %>_<%= i.to_s %>')); | ||||||
|           chart_<%= qid %>_<%= option %>.draw(data_<%= qid %>_<%= option %>, {title: '<%= question.title %> - <%= options[option] %>'}); |           chart_xx.draw(data_<%= qid %>, {title: '<%= question.title %> - <%= options[option] %>'}); | ||||||
|  |             <% i = i + 1 %> | ||||||
|           <% end %> |           <% end %> | ||||||
|         <% end %> |         <% end %> | ||||||
|       <% end %> |       <% end %> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue