/
_scripts.html.erb
128 lines (127 loc) · 2.41 KB
/
_scripts.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!--
Column Bar chart
-->
<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'containerColumnBar',
type: 'column',
margin: [ 50, 50, 100, 80]
},
credits: {
enabled: false
},
title: {
text: '<%=t :hr_columnbar_title_label%>'
},
xAxis: {
categories: [
<% @statusesByAssigneds.group_by(&:assigned_name).each do |s, t| %>
<%= (s.nil? ? t(:hr_unassigned_issue_label) : s).inspect.html_safe%>,
<%end%>
],
labels: {
rotation: -45,
align: 'right',
style: {
font: 'normal 13px Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: '<%=t :hr_columnbar_yaxis_label%>'
}
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
'<%=t :tasks_label%>: '+ Highcharts.numberFormat(this.y, 0) ;
}
},
series: [{
data: [<% @statusesByAssigneds.group_by(&:assigned_name).each do |s, t| %>
<%= t.map{|a| a.totalassignedbystatuses.to_i}.sum.inspect.html_safe%>,
<%end%>
],
dataLabels: {
enabled: true,
rotation: -90,
color: '#FFFFFF',
align: 'right',
x: -3,
y: 10,
formatter: function() {
return this.y;
},
style: {
font: 'normal 13px Verdana, sans-serif'
}
}
}]
});
});
</script>
<!--
Stacked Bar chart
-->
<script type="text/javascript">
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'containerStackedBar',
type: 'bar'
},
credits: {
enabled: false
},
title: {
text: '<%=t :hr_stackedcolumnbar_title_label%>'
},
xAxis: {
categories: [
<% @statusesByAssigneds.group_by(&:assigned_name).each do |s, t| %>
<%= (s.nil? ? t(:hr_unassigned_issue_label) : s).inspect.html_safe%>,
<%end%>
]
},
yAxis: {
min: 0,
title: {
text: '<%=t :hr_stackedcolumnbar_yaxis_label%>'
}
},
legend: {
backgroundColor: '#FFFFFF',
reversed: false
},
tooltip: {
formatter: function() {
return ''+
this.series.name +': '+ this.y +'';
}
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series:
[
<% @statusesByAssigneds.group_by(&:name).each do |s, t| %>
{
name: '<%= s.to_s%>',
data: <%= t.map{|a| a.totalassignedbystatuses.to_i}.inspect.html_safe%>
},
<%end%>
]
});
});
</script>