|
|
@ -64,14 +64,16 @@ |
|
|
|
|
|
|
|
<!-- DIV solution --> |
|
|
|
<em>DIV solution</em> |
|
|
|
<div class="row"> |
|
|
|
<% grades.data.sort_by(&:first).each do |grade, number| %> |
|
|
|
<div class="cumulative-datas"> |
|
|
|
<% left = 0 |
|
|
|
grades.data.sort_by(&:first).each do |grade, number| %> |
|
|
|
<% unless %w(T V).include?(grade) |
|
|
|
percent = (number.to_f / total.to_f) * 100.0 |
|
|
|
color = colors[grade] %> |
|
|
|
<div style="width: <%= percent.round %>%; height: 2rem; line-height: 2rem; display: inline-block; background-color: <%= color %>; white-space: nowrap; text-overflow: ellipsis; margin-right: 2px"> |
|
|
|
<div class="cumulative-data" style="left: <%= left %>; width: <%= percent.round %>%; background-color: <%= color %>;"> |
|
|
|
<%= "#{grade}: #{percent.round}% (#{number})" %> |
|
|
|
</div> |
|
|
|
<% left += percent.round %> |
|
|
|
<% end |
|
|
|
end %> |
|
|
|
</div> |
|
|
|