136 lines
4.4 KiB
Plaintext
136 lines
4.4 KiB
Plaintext
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||
<div id = "container" style="max-width:360px;min-height:400px;width:370px;float: left">
|
||
</div>
|
||
<div id = "container_code" style="max-width:360px;min-height:400px;width:370px;float: left">
|
||
</div>
|
||
<script>
|
||
$(function () {
|
||
$('#container_code').highcharts({
|
||
chart: {
|
||
type: 'line'
|
||
},
|
||
title: {
|
||
text: '版本库代码提交行数',
|
||
style:{
|
||
fontSize: '14px'
|
||
}
|
||
|
||
},
|
||
subtitle: {
|
||
// text: 'Source: WorldClimate.com'
|
||
},
|
||
xAxis: {
|
||
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||
categories: <%= raw(@a_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: {
|
||
series: {
|
||
marker: {
|
||
radius: 3, //曲线点半径,默认是4
|
||
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
|
||
}
|
||
},
|
||
line: {
|
||
dataLabels: {
|
||
enabled: true
|
||
},
|
||
enableMouseTracking: false
|
||
}
|
||
},
|
||
series: [{
|
||
name: '改动或增加',
|
||
color: '#fd9e04',
|
||
|
||
// 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: <%= @a_commits_add %>,
|
||
lineWidth: 1.5
|
||
},
|
||
{
|
||
name: '删除',
|
||
color: '#46baed ',
|
||
data: <%= @a_commits_del %>,
|
||
lineWidth: 1.5
|
||
},{
|
||
name: '总变更',
|
||
color: '#d397d5',
|
||
data: <%= @a_commits_changeset %>,
|
||
lineWidth: 1.5
|
||
}]
|
||
});
|
||
|
||
// 代码提交次数统计
|
||
$('#container').highcharts({
|
||
chart: {
|
||
type: 'line'
|
||
},
|
||
credits:{
|
||
enabled: false
|
||
},
|
||
title: {
|
||
text: '版本库代码提交次数',
|
||
style:{
|
||
fontSize: '14px'
|
||
}
|
||
|
||
},
|
||
subtitle: {
|
||
// text: 'Source: WorldClimate.com'
|
||
},
|
||
xAxis: {
|
||
// categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||
categories: <%= raw(@a_uname) %>
|
||
},
|
||
yAxis: {
|
||
title: {
|
||
text: '次'
|
||
}
|
||
},
|
||
tooltip: {
|
||
enabled: false,
|
||
formatter: function() {
|
||
return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
|
||
}
|
||
},
|
||
plotOptions: {
|
||
series: {
|
||
marker: {
|
||
radius: 3, //曲线点半径,默认是4
|
||
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
|
||
}
|
||
},
|
||
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: <%= @a_commits_num %>,
|
||
lineWidth: 1.5
|
||
|
||
}
|
||
// {
|
||
// 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> |