';
if (a.values.length > 4) {
out += ' ' + a.values.length + ' IXPs';
}
out += ' ' +
a.values[0].cit + ', ' + a.values[0].ctry + '
';
out += '';
for (i = 0; i " + a.values[i].name + "";
}
out += "
";
return out;
},
},
countries: {
attr: { // todo min, max, empty, legend and rollup don't work
fill: {
min: "#B4C3D1",
max: "#043864",
empty: "#f9f9f9",
aggregate: {
key: getAggregateKey,
mode: getAggregateMode,
scale: 'rank', // legend doesn't work with a non-linear scale
}
},
stroke: "#d9d9d9",
"stroke-width": 0.5
},
tooltip: function (a) {
out = '';
if (!a.values.length || a.attrProperties.fill.value === 0) {
out += '' + a.properties.name + '
';
return out;
}
out += ' ' + a.values[0].ctry + '
';
out += '';
out += modeFormatted[a.attrProperties.fill.mode] + ' ';
if (a.attrProperties.fill.key !== 'id') {
out += a.attrProperties.fill.columnDetails.title + ' ';
}
out += a.attrProperties.fill.formatted;
if (a.attrProperties.fill.mode === 'count') {
out += ' IXPs';
}
out += "
";
return out;
}
}
})
.filters({
show: ['reg', 'ctry', 'cit', 'name', 'prts','traf', 'avg','pch', 'stat', 'q9' ],
})
.table({
show: ['reg', 'ctry', 'cit', 'name', 'prts','traf', 'avg','ipv6_avg', 'prfs', 'date', 'url'],
collapseRowsBy: ['reg'],
defaultSorting: [
{
key: 'ctry',
mode: 'asc',
},
{
key: 'cit',
mode: 'asc',
},
],
rowClassName: function(d){
var thirtyDays = new Date().getTime() - (30 * 24 * 60 * 60 * 1000);
var rowDate = new Date(d.updt).getTime();
var recentClass = '';
var statusClass = '';
if (d.stat != 'Active'){
statusClass = 'inactive';
}
return statusClass + ' ' + recentClass;
}
})
.columns({
pch: {
title: 'PCH Present',
filterMethod: 'dropdown',
},
q9: {
title: 'Quad9 Present',
filterMethod: 'dropdown',
},
ipv6_avg: {
title: 'IPv6',
cellContent: function(d){
return getIpv6Field(d.ipv6_avg);
},
},
stat: {
title: 'Status',
filterMethod: 'dropdown',
},
cit: {
title: 'City',
filterMethod: 'dropdown',
cellContent: function(d){
return d.cit;
},
},
ctry: {
title: 'Country',
filterMethod: 'dropdown',
cellContent: function(d){
return d.ctry;
},
},
name: {
title: 'IXP Name',
cellContent: function(d){
var title, linkHtml, traffic;
if (d.stat == 'Active'){
if (d.traf == 0){
traffic = '0';
} else {
traffic = getHumanSize(d.traf) + ' of ';
}
title = ' title="(participants) ' + d.prts + ' ISPs participate at ';
title += d.name + '. By participants it ranks #' + d.pc_rank + ' in ' ;
title += d.ctry + ', #' + d.pr_rank + ' in ' + d.reg + ', and #' + d.pw_rank;
title += ' in the world.\n\n(traffic) ' + d.name + ' peaks at ' + traffic;
title += ' traffic each day. By traffic, it ranks #' + d.tc_rank + ' in ' ;
title += d.ctry + ', #' + d.tr_rank + ' in ' + d.reg + ', and #' + d.tw_rank;
title += ' in the world." ';
}
linkHtml = '' + d.name + '';
return linkHtml;
},
},
prts: {
title: 'Participants',
cellContent: function(d){
if (d.prts >= -1) {
if (d.prts > 0 && d.prts_url != '') {
return '' + d.prts + '';
} else {
return d.prts;
}
} else {
return emptyIcon;
}
},
},
traf: {
nowrap: true,
title: 'Peak',
cellContent: function(d){
return getTrafficField(d.traf, d.updt);
},
},
avg: {
nowrap: true,
title: 'Avg',
cellContent: function(d){
return getTrafficField(d.avg, d.updt);
},
},
url: {
title: 'URL',
cellContent: function(d){
var value;
var title = 'title="Go to ' + d.name + '\'s site."';
if (d.url !== '') {
if (d.url.substring(0,4) == 'http'){
value = '';
} else {
value = emptyIcon;
}
return value;
},
},
reg: {
nowrap: true,
filterMethod: 'dropdown',
title: 'Region',
cellContent: function (d){
return d.reg +' (' + d.regct + ')';
}
},
prfs: {
cellContent: function(d){
var prfs;
if (d.prfs != '0') {
prfs = d.prfs;
} else {
prfs = emptyIcon;
}
return prfs;
},
title: 'Prefixes',
},
date: {
inputType: "date",
type: "custom",
cellContent: function(a) {
months = new Array('', "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec");
year = 1 * parseInt(a.date.substring(0, 4));
month = 1 * parseInt(a.date.substring(4, 6));
if (!isNaN(month) && 0 !== month) month = months[month];
else month = '';
day = 1 * parseInt(a.date.substring(6, 8));
output = day + " " + month + " " + year;
if (isNaN(day) || 0 === day) output = month + " " + year;
if ('' === month) output = year;
if (isNaN(year) || 0 === year || a.stat == 'Planned')
output = emptyIcon;
return output;
},
title: 'Established',
},
updt: {
inputType: "date",
type: "date",
title: 'Last Updated',
}
})
.render(attachAggregateHeaderAndAddThClickHandler);