Add bar chart
This commit is contained in:
parent
582562dae0
commit
c4ebe12408
5 changed files with 26 additions and 7 deletions
|
|
@ -3,6 +3,8 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= _("Vote") %></title>
|
||||
<script src="/chartkick.js"></script>
|
||||
<script src="/Chart.bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<% if current_user %>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,20 @@
|
|||
<% end %>
|
||||
</table>
|
||||
|
||||
<%
|
||||
data = []
|
||||
colors = []
|
||||
settings.values.reverse.each do |v|
|
||||
d = { name: v[:label], data: [] }
|
||||
@vote.candidates.each do |c|
|
||||
d[:data] << [c.name, c.mj.count[v[:id]]]
|
||||
end
|
||||
data << d
|
||||
colors << v[:color]
|
||||
end
|
||||
%>
|
||||
<%= bar_chart data, colors: colors, stacked: true, legend: 'bottom' %>
|
||||
|
||||
<h2><%= _("Organizers") %></h2>
|
||||
|
||||
<ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue