-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.11 on 2020-03-17 04:29 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contributors', '0002_issueinfo'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='issueinfo', | ||
name='issue', | ||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='info', to='contributors.Contribution', verbose_name='issue'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function generateMonths() { | ||
const months = []; | ||
for (let i = 1; i <= 12; i += 1) { | ||
months.push(moment().add(i,'months').format('MMM')); | ||
} | ||
return months; | ||
} | ||
|
||
const contributions = JSON.parse(document.getElementById('contributions').textContent); | ||
|
||
const ctx = document.getElementById('yearActivityChart').getContext('2d'); | ||
const yearActivityChart = new Chart(ctx, { | ||
type: 'bar', | ||
data: { | ||
labels: generateMonths(), | ||
datasets: [ | ||
{ | ||
label: gettext('Commits'), | ||
data: contributions.commits, | ||
backgroundColor: 'rgba(87, 173, 219, 0.7)', | ||
}, | ||
{ | ||
label: gettext('Pull requests'), | ||
data: contributions.pull_requests, | ||
backgroundColor: 'rgba(82, 206, 97, 0.7)', | ||
}, | ||
{ | ||
label: gettext('Issues'), | ||
data: contributions.issues, | ||
backgroundColor: 'rgba(226, 113, 90, 0.7)', | ||
}, | ||
{ | ||
label: gettext('Comments'), | ||
data: contributions.comments, | ||
backgroundColor: 'rgba(242, 232, 96, 0.7)', | ||
}, | ||
], | ||
}, | ||
options: { | ||
tooltips: { | ||
mode: 'index', | ||
intersect: false, | ||
}, | ||
animation: { | ||
duration: 0, | ||
}, | ||
scales: { | ||
xAxes: [{ | ||
stacked: true, | ||
}], | ||
yAxes: [{ | ||
stacked: true, | ||
}], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,4 @@ | ||
{% load i18n %} | ||
<div class="mb-5"><canvas id="yearActivityChart"></canvas></div> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script> | ||
{{ contributions|json_script:'contributions' }} | ||
<script> | ||
function generateMonths() { | ||
const months = []; | ||
for (let i = 1; i <= 12; i += 1) { | ||
months.push(moment().add(i,'months').format('MMM')); | ||
} | ||
return months; | ||
} | ||
|
||
const contributions = JSON.parse(document.getElementById('contributions').textContent); | ||
{% load static %} | ||
|
||
const ctx = document.getElementById('yearActivityChart').getContext('2d'); | ||
const yearActivityChart = new Chart(ctx, { | ||
type: 'bar', | ||
data: { | ||
labels: generateMonths(), | ||
datasets: [ | ||
{ | ||
label: '{% trans "Commits" %}', | ||
data: contributions.commits, | ||
backgroundColor: 'rgba(87, 173, 219, 0.7)', | ||
}, | ||
{ | ||
label: '{% trans "Pull requests" %}', | ||
data: contributions.pull_requests, | ||
backgroundColor: 'rgba(82, 206, 97, 0.7)', | ||
}, | ||
{ | ||
label: '{% trans "Issues" %}', | ||
data: contributions.issues, | ||
backgroundColor: 'rgba(226, 113, 90, 0.7)', | ||
}, | ||
{ | ||
label: '{% trans "Comments" %}', | ||
data: contributions.comments, | ||
backgroundColor: 'rgba(242, 232, 96, 0.7)', | ||
}, | ||
], | ||
}, | ||
options: { | ||
tooltips: { | ||
mode: 'index', | ||
intersect: false, | ||
}, | ||
animation: { | ||
duration: 0, | ||
}, | ||
scales: { | ||
xAxes: [{ | ||
stacked: true, | ||
}], | ||
yAxes: [{ | ||
stacked: true, | ||
}], | ||
}, | ||
}, | ||
}); | ||
</script> | ||
<div class="mb-5"><canvas id="yearActivityChart"></canvas></div> | ||
<script src="{% static 'js/yearActivityChart.js' %}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters