Updated texts and charts
This commit is contained in:
@ -16,4 +16,103 @@ jQuery(document).ready(function($)
|
||||
var goodMail = a2 + a9 + a4 + a7 + a3 + a5 + a1 + a6 + a8;
|
||||
$(this).attr('href', href.replace('badmail', goodMail + '?subject=[Ginou] Contact'));
|
||||
});
|
||||
|
||||
// photos stats
|
||||
fifties = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
sixties = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
seventies = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
eighties = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
nineties = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
zeroes = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
tens = {"none": 0, "bad": 0, "ok": 0, "good": 0};
|
||||
|
||||
$.getJSON("data.json", function(data)
|
||||
{
|
||||
function gatherYear(array, min, max)
|
||||
{
|
||||
if (i.year >= min && i.year <= max)
|
||||
{
|
||||
if (i.photo == "none") array.none++;
|
||||
if (i.photo == "bad") array.bad++;
|
||||
if (i.photo == "ok") array.ok++;
|
||||
if (i.photo == "good") array.good++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i of data)
|
||||
{
|
||||
gatherYear(fifties, 1950, 1959);
|
||||
gatherYear(sixties, 1960, 1969);
|
||||
gatherYear(seventies, 1970, 1979);
|
||||
gatherYear(eighties, 1980, 1989);
|
||||
gatherYear(nineties, 1990, 1999);
|
||||
gatherYear(zeroes, 2000, 2009);
|
||||
gatherYear(tens, 2010, 2020);
|
||||
}
|
||||
|
||||
var canvasDimension = document.getElementById("photo").getContext('2d');
|
||||
var chartDimension = new Chart(canvasDimension, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["1956 - 1959", "1960 - 1969", "1970 - 1979", "1980 - 1989", "1990 - 1999", "2000 - 2009", "2010 - 2016"],
|
||||
datasets: [{
|
||||
label: 'Pas de photo',
|
||||
backgroundColor: '#FB6962',
|
||||
data: [
|
||||
fifties.none, sixties.none, seventies.none, eighties.none, nineties.none, zeroes.none, tens.none
|
||||
]
|
||||
}, {
|
||||
label: 'Photo de mauvaise qualité',
|
||||
backgroundColor: '#FCFC99',
|
||||
data: [
|
||||
fifties.bad, sixties.bad, seventies.bad, eighties.bad, nineties.bad, zeroes.bad, tens.bad
|
||||
]
|
||||
}, {
|
||||
label: 'Photo de qualité acceptable',
|
||||
backgroundColor: '#79DE79',
|
||||
data: [
|
||||
fifties.ok, sixties.ok, seventies.ok, eighties.ok, nineties.ok, zeroes.ok, tens.ok
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Photo de bonne qualité',
|
||||
backgroundColor: '#0CC078',
|
||||
data: [
|
||||
fifties.good, sixties.good, seventies.good, eighties.good, nineties.good, zeroes.good, tens.good
|
||||
]
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}, gridLines: {
|
||||
display: true
|
||||
},
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: 'Tableaux'
|
||||
},
|
||||
stacked: true,
|
||||
}],
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
display: false
|
||||
},
|
||||
stacked: true,
|
||||
}]
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
position: "bottom",
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -80,10 +80,10 @@ jQuery(document).ready(function($)
|
||||
var chartDimension = new Chart(canvasDimension, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["< 20cm", "20cm - 29cm", "30cm - 39cm", "40cm - 49cm", "50cm - 59cm", "60cm - 69cm", "70cm - 79cm", "80cm - 89cm", "90cm - 99cm", ">= 100cm"],
|
||||
labels: ["Allégorique", "Animal domestique", "Animalier", "Campagne", "Forêt", "Marine", "Montagne", "Métier", "Personne", "Urbain", "Végétal"],
|
||||
datasets: [{
|
||||
label: 'nombre de tableaux',
|
||||
data: [1, 60, 54, 97, 50, 54, 11, 2, 1, 2],
|
||||
data: [2, 11, 67, 126, 3, 10, 5, 10, 46, 39, 39],
|
||||
backgroundColor: '#2589BD',
|
||||
borderColor: '#187795',
|
||||
borderWidth: 1
|
||||
|
Reference in New Issue
Block a user