Public
Edited
Nov 20, 2024
1 star
Insert cell
Insert cell
Insert cell
Insert cell
hilbertChart = {
const margin = 50;
const hilbertChart = HilbertChart()
.width(chartWidth - margin * 2)
.margin(margin)
.hilbertOrder(20 / 2)
.data(parseAsnData(ianaData))
.rangePadding(0.03);

setTimeout(() => hilbertChart.focusOn(0, 2 ** 16), 100); // Focus on 16-bit area
return hilbertChart;

//
function parseAsnData(asnData) {
const asns = [];
const ignoreNames = ['see sub-registry 16-bit as numbers']; // Remove 16bit placeholder

asnData.map(asn => {
const asRange = asn.Number.split('-');
return {
start: +asRange[0],
length: asRange.length > 1 ? +asRange[1] - asRange[0] + 1 : 1,
name: asn.Description.replace('Assigned by', ''),
infos: [asn]
};
}).filter(asn =>
ignoreNames.indexOf(asn.name.toLowerCase()) === -1
).filter(asn =>
// Filter out really high stuff (perf issue)
asn.name.toLowerCase() !== 'unallocated' && (asn.start + asn.length) <= Math.pow(2, 24)
).forEach(asn => {
let last;

if (asns.length
&& (last = asns[asns.length - 1])
&& last.name === asn.name
&& (last.start + last.length === asn.start)) {

last.length += asn.length;
last.infos.push(asn.infos[0]);
} else {
asns.push(asn);
}
});

return asns;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more