socialforge/app/views/repositories/stats.html.erb

123 lines
4.3 KiB
Plaintext

<%= javascript_include_tag 'highcharts','highcharts-more' %>
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<h2 class="project_h2"><%= l(:label_statistics) %></h2>
</div>
<% if false %>
<div class="flash notice">请在版本库中提交代码,统计信息将更准确</div>
<% else %>
<div class="repository_con " style="line-height:1.9;">
<%= render :partial => 'navigation' %>
<div class="cl"></div>
</div>
<div id = "container">
</div>
<div id = "container_code" class="mt30">
</div>
<script>
$(function () {
$('#container_code').highcharts({
chart: {
type: 'line'
},
title: {
text: '代码提交量'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '代码行数'
}
},
credits:{
enabled: false
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '改动或增加',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.add.to_i} %>
},
{
name: '删除',
data: <%= @static_total_per_user.map{|c| c.del.to_i} %>
},{
name: '总变更',
data: <%= @static_total_per_user.map{|c| c.changes.to_i} %>
}]
});
// 代码提交次数统计
$('#container').highcharts({
chart: {
type: 'line'
},
credits:{
enabled: false
},
title: {
text: '代码提交次数'
},
subtitle: {
// text: 'Source: WorldClimate.com'
},
xAxis: {
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
categories: <%= raw(@static_total_per_user.map{|c| c.uname}) %>
},
yAxis: {
title: {
text: '次'
}
},
tooltip: {
enabled: false,
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: '提交次数',
// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
data: <%= @static_total_per_user.map{|c| c.commits_num.to_i} %>
}
// {
// name: 'London',
// data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
// }
]
});
});
</script>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
<% end %>