mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-11 19:02:16 +01:00
Made join-address pie show text instead when there is only one address
Affects issues: - Close #1809
This commit is contained in:
parent
a0029f1df8
commit
837616159c
@ -419,31 +419,43 @@ function serverPie(id, serverSeries) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function joinAddressPie(id, joinAddresses) {
|
function joinAddressPie(id, joinAddresses) {
|
||||||
graphs.push(Highcharts.chart(id, {
|
if (joinAddresses.data.length < 2) {
|
||||||
chart: {
|
document.getElementById(id).innerHTML = '<div class="card-body"><p></p></div>'
|
||||||
plotBackgroundColor: null,
|
document.getElementById(id).classList.remove('chart-area');
|
||||||
plotBorderWidth: null,
|
|
||||||
plotShadow: false,
|
// XSS danger appending join addresses directly, using innerText is safe.
|
||||||
type: 'pie'
|
for (let slice of joinAddresses.data) {
|
||||||
},
|
document.querySelector(`#${id} p`).innerText = `${slice.name}: ${slice.y}`;
|
||||||
title: {text: ''},
|
}
|
||||||
plotOptions: {
|
} else {
|
||||||
pie: {
|
document.getElementById(id).innerHTML = '';
|
||||||
allowPointSelect: true,
|
document.getElementById(id).classList.add('chart-area');
|
||||||
cursor: 'pointer',
|
graphs.push(Highcharts.chart(id, {
|
||||||
dataLabels: {
|
chart: {
|
||||||
enabled: false
|
plotBackgroundColor: null,
|
||||||
},
|
plotBorderWidth: null,
|
||||||
showInLegend: true
|
plotShadow: false,
|
||||||
}
|
type: 'pie'
|
||||||
},
|
},
|
||||||
tooltip: {
|
title: {text: ''},
|
||||||
formatter: function () {
|
plotOptions: {
|
||||||
return '<b>' + this.point.name + ':</b> ' + this.y + ' (' + this.percentage.toFixed(2) + '%)';
|
pie: {
|
||||||
}
|
allowPointSelect: true,
|
||||||
},
|
cursor: 'pointer',
|
||||||
series: [joinAddresses]
|
dataLabels: {
|
||||||
}));
|
enabled: false
|
||||||
|
},
|
||||||
|
showInLegend: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
formatter: function () {
|
||||||
|
return '<b>' + this.point.name + ':</b> ' + this.y + ' (' + this.percentage.toFixed(2) + '%)';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [joinAddresses]
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTimeAmount(ms) {
|
function formatTimeAmount(ms) {
|
||||||
|
Loading…
Reference in New Issue
Block a user