Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit fce6ace

Browse files
committed
tweaks
- changed width ratio of pie chart and its legend from 6:6 to 7:5 - hyperlinks in tables only in first column - no underline in tables - pie chart legend items with multiline labels are aligned
1 parent ddd62ff commit fce6ace

File tree

3 files changed

+50
-32
lines changed

3 files changed

+50
-32
lines changed

templates/functions.include.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ function pieChart($id)
33
{
44
?>
55
<div class="pie-chart-container row">
6-
<div class="canvas-container col-md-6">
6+
<div class="canvas-container col-md-7">
77
<canvas id="<?php echo $id;?>" class="pieChart chart-<?php echo $id;?>"></canvas>
88
</div>
9-
<div class="legend-container col-md-6"></div>
9+
<div class="legend-container col-md-5"></div>
1010
</div>
1111
<?php
1212
}

www/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,17 @@ function drawPieChart(colNames, dataName, viewCols, url, getEl) {
223223

224224
if (datasets.length) {
225225
for (var i = 0; i < datasets[0].data.length; ++i) {
226-
text.push('<li class="chart-legend-item"><span class="bg-color-'
227-
+ datasets[0].backgroundColor[i].substr(1)
228-
+ '"></span>');
226+
var liClasses = ['chart-legend-item'];
227+
if (other && i === datasets[0].data.length - 1) {
228+
liClasses.push('other');
229+
}
230+
text.push('<li class="' + liClasses.join(' ') + '">');
229231
if (labels[i]) {
230232
var label = labels[i];
231233
if (url && (!other || i < datasets[0].data.length - 1)) {
232-
label = '<a href="' + url + encodeURIComponent(data[i][1]) + '">' + label + '</a>';
234+
label = '<a href="' + url + encodeURIComponent(data[i][1]) + '" class="item">' + label + '</a>';
235+
} else {
236+
label = '<span class="item">' + label + '</span>';
233237
}
234238
text.push(label);
235239
}
@@ -299,7 +303,7 @@ function drawCountTable(cols, dataCol, countCol, dataName, allowHTML, url, getEl
299303
if (viewCols[i] === countCol) {
300304
td.className = 'text-right';
301305
}
302-
if (url) {
306+
if (url && viewCols[i] === dataCol) {
303307
a = document.createElement('a');
304308
a[allowHTML ? 'innerHTML' : 'innerText'] = data[j][viewCols[i]];
305309
a.href = url + encodeURIComponent(data[j][1]);

www/statisticsproxy.css

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ h1, h2, h3 {
5959
.legend-container, .canvas-container, .table-container {
6060
height: 90vh;
6161
max-height: 500px;
62-
width: 90vw;
6362
max-width: 100%;
6463
}
6564

@@ -71,39 +70,54 @@ h1, h2, h3 {
7170
overflow-y: auto;
7271
}
7372

74-
.bg-color-3366CC { background-color: #3366CC; }
75-
.bg-color-DC3912 { background-color: #DC3912; }
76-
.bg-color-FF9900 { background-color: #FF9900; }
77-
.bg-color-109618 { background-color: #109618; }
78-
.bg-color-990099 { background-color: #990099; }
79-
.bg-color-3B3EAC { background-color: #3B3EAC; }
80-
.bg-color-0099C6 { background-color: #0099C6; }
81-
.bg-color-DD4477 { background-color: #DD4477; }
82-
.bg-color-66AA00 { background-color: #66AA00; }
83-
.bg-color-B82E2E { background-color: #B82E2E; }
84-
.bg-color-316395 { background-color: #316395; }
85-
.bg-color-994499 { background-color: #994499; }
86-
.bg-color-22AA99 { background-color: #22AA99; }
87-
.bg-color-AAAA11 { background-color: #AAAA11; }
88-
.bg-color-6633CC { background-color: #6633CC; }
89-
.bg-color-E67300 { background-color: #E67300; }
90-
.bg-color-8B0707 { background-color: #8B0707; }
91-
.bg-color-329262 { background-color: #329262; }
92-
.bg-color-5574A6 { background-color: #5574A6; }
93-
.bg-color-3B3EAC { background-color: #3B3EAC; }
94-
.bg-color-DDDDDD { background-color: #DDDDDD; }
95-
96-
.legend-container li span {
73+
.chart-legend .item {
74+
display: inline-block;
75+
text-indent: -2.5em;
76+
margin-left: 2.5em;
77+
}
78+
79+
.chart-legend li .item:before {
80+
content: '';
9781
display: inline-block;
9882
width: 2em;
9983
height: 0.7em;
10084
margin-right: 0.5em;
10185
}
86+
.chart-legend li:nth-child(20n+1) .item:before { background-color: #3366CC; }
87+
.chart-legend li:nth-child(20n+2) .item:before { background-color: #DC3912; }
88+
.chart-legend li:nth-child(20n+3) .item:before { background-color: #FF9900; }
89+
.chart-legend li:nth-child(20n+4) .item:before { background-color: #109618; }
90+
.chart-legend li:nth-child(20n+5) .item:before { background-color: #990099; }
91+
.chart-legend li:nth-child(20n+6) .item:before { background-color: #3B3EAC; }
92+
.chart-legend li:nth-child(20n+7) .item:before { background-color: #0099C6; }
93+
.chart-legend li:nth-child(20n+8) .item:before { background-color: #DD4477; }
94+
.chart-legend li:nth-child(20n+9) .item:before { background-color: #66AA00; }
95+
.chart-legend li:nth-child(20n+10) .item:before { background-color: #B82E2E; }
96+
.chart-legend li:nth-child(20n+11) .item:before { background-color: #316395; }
97+
.chart-legend li:nth-child(20n+12) .item:before { background-color: #994499; }
98+
.chart-legend li:nth-child(20n+13) .item:before { background-color: #22AA99; }
99+
.chart-legend li:nth-child(20n+14) .item:before { background-color: #AAAA11; }
100+
.chart-legend li:nth-child(20n+15) .item:before { background-color: #6633CC; }
101+
.chart-legend li:nth-child(20n+16) .item:before { background-color: #E67300; }
102+
.chart-legend li:nth-child(20n+17) .item:before { background-color: #8B0707; }
103+
.chart-legend li:nth-child(20n+18) .item:before { background-color: #329262; }
104+
.chart-legend li:nth-child(20n+19) .item:before { background-color: #5574A6; }
105+
.chart-legend li:nth-child(20n) .item:before { background-color: #3B3EAC; }
106+
.chart-legend li.other .item:before { background-color: #DDDDDD; }
107+
102108
.legend-container ul, .legend-container li {
103109
list-style-type: none;
104110
}
105111

106112
.table-container.scrolling th {
107113
background-color: white;
108114
box-shadow: 0 4px 5px -5px #666;
109-
}
115+
}
116+
117+
.table-container a, .chart-legend a {
118+
border: 0;
119+
}
120+
.table-container a:not(:hover):not(:focus):not(:active),
121+
.chart-legend a:not(:hover):not(:focus):not(:active) {
122+
text-decoration: none;
123+
}

0 commit comments

Comments
 (0)