diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d077fe5..0a4976e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -29,7 +29,7 @@ def recommand_link(form) end def random_color - ['FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF','C0C0C0'][rand(6)] + ['194E84','1F242A','60BB22','F2BABB','FFC200','FF5B00','B80028','84002E','4AC0F2'][rand(8)] end end diff --git a/app/views/forms/_chart.html.erb b/app/views/forms/_chart.html.erb index 3cd13bb..aa4cf34 100644 --- a/app/views/forms/_chart.html.erb +++ b/app/views/forms/_chart.html.erb @@ -4,7 +4,7 @@
<% data = field.options.map {|o| @form.klass.count({"f#{field.id}" => Regexp.new('(\s|^)' + o.value + '(\s|$)')})} %> <% if field.options.length >= 5 %> - + <% else %> @@ -13,21 +13,20 @@
- + - - + <% field.options.each do |option| %> <% option_count = @form.klass.count({"f#{field.id}" => Regexp.new('(\s|^)' + option.value + '(\s|$)')}) %> - <%# percentage = option_count * 100 / @form.rows_count %> + <% percentage = option_count * 100 / @form.rows_count %> - + <% if false %>
选项数量数量
<%=option.value%><%#=link_to option.value,chart_form_path(@form,:filter => option) %><%=option.value%><%#=link_to option.value,chart_form_path(@form,:filter => option) %> <%= option_count %>