Add bar chart

This commit is contained in:
ricola 2025-04-06 17:04:31 -06:00
parent 582562dae0
commit c4ebe12408
5 changed files with 26 additions and 7 deletions

View file

@ -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 %>

View file

@ -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>