-
Notifications
You must be signed in to change notification settings - Fork 0
/
VizuHAL_grf_histo_req1.php
95 lines (87 loc) · 3.41 KB
/
VizuHAL_grf_histo_req1.php
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
<?php
/*
* VizuHAL - Générez des stats HAL - Generate HAL stats
*
* Copyright (C) 2023 Olivier Troccaz ([email protected]) and Laurent Jonchère ([email protected])
* Released under the terms and conditions of the GNU General Public License (https://www.gnu.org/licenses/gpl-3.0.txt)
*
* Graphes histogrammes pour la requête 1 - Histogram graphs for query 1
*/
function grf_histo($anneedeb, $anneefin, $arrRes, $team, $orig) {
//Tableau de couleurs
$tabCol = array('rgba(78, 121, 167, 1)', 'rgba(160, 203, 232, 1)', 'rgba(242, 142, 43, 1)', 'rgba(255, 190, 125, 1)', 'rgba(89, 161, 79, 1)', 'rgba(140, 209, 125, 1)', 'rgba(182, 153, 45, 1)', 'rgba(241, 206, 99, 1)', 'rgba(73, 152, 148, 1)', 'rgba(134, 188, 182, 1)', 'rgba(225, 87, 89, 1)', 'rgba(225, 157, 154, 1)', 'rgba(121, 112, 110, 1)', 'rgba(186, 176, 172, 1)', 'rgba(211, 114, 149, 1)', 'rgba(250, 191, 210, 1)', 'rgba(176, 122, 161, 1)', 'rgba(212, 166, 200, 1)', 'rgba(157, 118, 196, 1)', 'rgba(215, 181, 166, 1)');
//Création du tableau d'années de la période
$rYearArr = array();
for($year = $anneedeb; $year <= $anneefin; $year++) {
$rYearArr[] = $year;
}
echo '<div class="col-8 chartjs-chart">';
echo ' <canvas id="productions '.$team.'" width="700" height="280" class="border border-gray p-1"></canvas>';
echo ' <script>';
echo ' new Chart(document.getElementById("productions '.$team.'"), {';
echo ' type: "bar",';
echo ' data: {';
echo ' labels: '.json_encode($rYearArr).',';
echo ' datasets: [';
for($year = $anneedeb; $year <= $anneefin; $year++) {
$nbnoTI = $arrRes[$year][$team]["nfPronoTI"] - $arrRes[$year][$team]["nfPronoTIavOA"];
$nbavTI = $arrRes[$year][$team]["nfProavTI"];
$nbavOA = $arrRes[$year][$team]["nfPronoTIavOA"];
$col = 0;
echo '{';
echo 'label: ["Sans TI"],';
echo 'data: ['.$nbnoTI.'],';
echo 'backgroundColor: "'.$tabCol[$col].'"';
echo '},';
$col++;
echo '{';
echo 'label: ["Avec TI"],';
echo 'data: ['.$nbavTI.'],';
echo 'backgroundColor: "'.$tabCol[$col].'"';
echo '},';
$col++;
echo '{';
echo 'label: ["Avec lien externe vers PDF en OA"],';
echo 'data: ['.$nbavOA.'],';
echo 'backgroundColor: "'.$tabCol[$col].'"';
echo '},';
}
echo ' ]';
echo ' },';
echo ' options: {';
echo ' legend: { display: true },';
echo ' title: {';
echo ' display: true,';
echo ' text: "Productions HAL '.$team.'",';
echo ' fontStyle: "bold",';
echo ' fontSize: 18';
echo ' },';
echo ' scales: {';
echo ' yAxes: [{';
echo ' stacked: true,';
echo ' ticks: {';
echo ' min: 0';
echo ' },';
echo ' scaleLabel: {';
echo ' display: true,';
echo ' labelString: "Nombre",';
echo ' fontStyle: "bold",';
echo ' fontSize: 16';
echo ' }';
echo ' }],';
echo ' xAxes: [{';
echo ' stacked: true,';
echo ' scaleLabel: {';
echo ' display: true,';
echo ' labelString: "Année",';
echo ' fontStyle: "bold",';
echo ' fontSize: 16';
echo ' }';
echo ' }]';
echo ' }';
echo ' }';
echo ' });';
echo ' </script>';
echo '</div>';
}
?>