Public
Edited
Jan 8
Paused
7 forks
34 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
interpolatePalette = (colors) => {
return (t) =>
d3.piecewise(d3.interpolateLab, colors)(Math.min(Math.max(0, t), 1));
}
Insert cell
// Helper function to convert hex color to RGB
function hexToRgb(hex) {
let bigint = parseInt(hex.replace("#", ""), 16);
return [(bigint >> 16) & 255, (bigint >> 8) & 255, bigint & 255];
}
Insert cell
// Helper function to calculate relative luminance
function relativeLuminance([r, g, b]) {
[r, g, b] = [r, g, b].map((v) => {
v /= 255;
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
});
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}
Insert cell
// Helper function to calculate contrast ratio
function contrastRatio(luminance1, luminance2) {
let lighter = Math.max(luminance1, luminance2);
let darker = Math.min(luminance1, luminance2);
return (lighter + 0.05) / (darker + 0.05);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
eurostatmap = require("eurostat-map")
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