function setContinentsLoading(isLoading) {
$('#searchButton').prop('disabled', isLoading);
}
function continentsRender(mode, band) {
setContinentsLoading(true);
$('.alert').remove();
$.ajax({
url: base_url + 'index.php/continents/get_continents',
type: 'post',
data: {
mode: mode,
band: band,
},
dataType: 'json',
success: function (data) {
setContinentsLoading(false);
totalContinentQsos(data);
},
error: function () {
setContinentsLoading(false);
$('#continentContainer').html('
Unable to load continent statistics.
');
},
});
}
function totalContinentQsos(data) {
// using this to change color of legend and label according to background color
var color = ifDarkModeThemeReturn('white', 'grey');
if (data.length > 0) {
$('.continentstable > tbody').empty();
var labels = [];
var dataQso = [];
var totalQso = Number(0);
var $myTableBody = $('.continentstable > tbody');
var i = 1;
// building the rows in the table
var rowElements = data.map(function (row) {
var $row = $('
');
var $iterator = $(' | ').html(i++);
var $type = $(' | ').html(row.cont);
var $content = $(' | ').html(row.count);
$row.append($iterator, $type, $content);
return $row;
});
// finally inserting the rows
$myTableBody.append(rowElements);
$.each(data, function () {
labels.push(this.cont);
dataQso.push(this.count);
totalQso = Number(totalQso) + Number(this.count);
});
const COLORS = ["#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00", "#b82e2e", "#316395", "#994499"]
let chartStatus = Chart.getChart("continentChart"); //