Equal Earth Projection
Code
ts
export const config: ChartConfiguration<'choropleth'> = {
type: 'choropleth',
data,
options: {
scales: {
projection: {
axis: 'x',
projection: 'equalEarth',
},
color: {
axis: 'x',
interpolate: (v) => (v < 0.5 ? 'green' : 'red'),
legend: {
position: 'bottom-right',
align: 'right',
},
},
},
},
};
ts
import states10m from 'us-atlas/states-10m.json';
const nation: Feature = topojson.feature(states10m as any, states10m.objects.nation as any).features[0];
const states: Feature = topojson.feature(states10m as any, states10m.objects.states as any).features;
export const data: ChartConfiguration<'choropleth'>['data'] = {
labels: states.map((d) => d.properties.name),
datasets: [
{
label: 'States',
outline: nation,
data: states.map((d) => ({
feature: d,
value: Math.random() * 11,
})),
},
],
};