Parent: [e48759] (diff)

Child: [0c4bf2] (diff)

Download this file

bar.html    110 lines (88 with data), 2.6 kB

  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
{% extends g.theme.master %}
{% do g.register_app_css('bar.css',compress=False) %}
{% block title %}
{{c.project.name}} / {{c.app.config.options.mount_label}}
{% endblock %}
{% block header%}
{{c.project.name}} / {{c.app.config.options.mount_label}}:
Bitergia Metrics
{% endblock %}
{% block content %}
<p>
<img src="{{g.app_static('bitergia-logo.png')}}">
<h1>Evolution of Commits per Company in Open Stack</h1>
[
<a href="{{g.app_static('companies_commits_10.csv')}}">Data</a>
]
</p>
<div id="container"></div>
<!--[if IE]>
<script type="text/javascript" src="{{g.app_static('flashcanvas.js')}}"></script>
<![endif]-->
<script type="text/javascript" src="{{g.app_static('flotr2.js')}}"></script>
<script type="text/javascript"
src="{{g.app_static('jquery-1.7.1.min.js')}}"></script>
<script type="text/javascript" src="{{g.app_static('csv2json.js')}}"></script>
<script type="text/javascript">
var horizontal = false;
var container = document.getElementById('container');
basic_bars(container, horizontal);
function basic_bars(container, horizontal) {
$.get('{{g.app_static('companies_commits_10.csv')}}', function(csv) {
var data = CSVToArray(csv);
var names = [], values = [], points = [];
// First item is name, value title
for (var i=1; i<data.length; i++) {
names.push(data[i][0]);
values.push(data[i][1]);
points.push([i, parseFloat(data[i][1])]);
}
var horizontal = (horizontal ? true : false), // Show horizontal bars
d1 = [], // First data series
d2 = [], // Second data series
point, // Data point variable declaration
i;
for (i = 0; i < 4; i++) {
if (horizontal) {
point = [ Math.ceil(Math.random() * 20), i ];
} else {
point = [ i, Math.ceil(Math.random() * 20) ];
}
d1.push(point);
if (horizontal) {
point = [ Math.ceil(Math.random() * 20), i + 0.5 ];
} else {
point = [ i + 0.5, Math.ceil(Math.random() * 20) ];
}
d2.push(point);
}
;
// Draw the graph
// Flotr.draw(container, [ d1, d2 ], {
Flotr.draw(container, [ points ], {
bars : {
show : true,
horizontal : horizontal,
shadowSize : 0.5,
barWidth : 0.9
},
mouse : {
track : true,
relative : true
},
xaxis: {
noTicks: names.length,
tickFormatter: function(x) {
var x = parseInt(x);
return names[(x - 1)].substr(0,7);
}
},
yaxis : {
min : 0,
autoscaleMargin : 1
}
});
});
}
</script>
{% endblock %}