{
const legend = {
title: 'Population change',
format: '%',
orient: 'none',
legendX: Math.floor(0.65 * width),
legendY: 30,
direction: 'horizontal',
tickCount: 5,
gradientLength: 240,
gradientThickness: 8
};
const counties = vl.markGeoshape({stroke: null})
.data(vl.topojson(usa).feature('counties'))
.transform(
vl.lookup('id')
.from(vl.data(populationData).key('id').fields('delta'))
)
.encode(
vl.color().fieldQ('delta')
.scale({domain: [-0.03, 0, 0.03], scheme: 'redblue'})
.legend(legend),
vl.tooltip().fieldQ('delta').format('+.2%')
);
const states = vl.markGeoshape({fill: null, stroke: 'white', strokeWidth: 1})
.data(vl.topojson(usa).mesh('states'));
return vl.layer(counties, states)
.project(vl.projection('identity'))
.width(width)
.height(Math.floor(0.6 * width))
.padding(0)
.autosize('none')
.config({view: {stroke: null}})
.render();
}