-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (38 loc) · 1.36 KB
/
main.js
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
'use strict';
$(window).load(function() {
let scm = new ColorScheme;
scm.from_hue(21).scheme('triade').distance(0.1).add_complement(false).variation('pastel').web_safe(true);
let colors = scm.colors();
let instance = api.instance.get();
let json = api.boa.run('bug-src-mapper.boa');
$('#loading').hide();
$('#content').show();
let canvas = $('#chart-output').get(0).getContext("2d");
let chartData = [];
let count = 0;
for(let index in json.out) {
count++;
$('#numToShow').append(`<option value="${count}"> ${count} </option>`);
chartData.push({
label: index,
value: json.out[index],
color: '#' + _.sample(colors)
});
}
$('#numToShow').change(function() {
$('#output').html('<canvas id="chart-output"> </canvas>');
canvas = $('#chart-output').get(0).getContext('2d');
display($('#numToShow').val());
});
display(1);
$('#app-title').html(`Number of Commits per Developer on ${instance.repos.name}`);
function display(num) {
let limitedData = _.first(chartData, num);
$('#table-output-body').html('');
_.each(limitedData, function(element, index, list) {
let num = index + 1;
$('#table-output-body').append(`<tr><td> ${num} </td> <td> ${element.label} </td> <td> ${element.value} </td> </tr>`)
});
let outputChart = new Chart(canvas).Pie(limitedData, {responsive: true});
}
});