Skip to main content

Command Palette

Search for a command to run...

D
Dmitry5y ago

Problem was in scoping variable projection:

const projection = d3
  .geoAlbersUsa()
  .scale(1300)
  .translate(width / 2, height / 2);

I checked with console.log(projection(-86.300568, 32.377716)) and in output was null. So I changed

`translate(${projection([longitude, latitude]).join(",")})`

to

`translate(${d3
      .geoAlbersUsa()
      .scale(1300)
      .translate([width / 2, height / 2])([longitude, latitude])
      .join(",")})`

And it works now! 😃

But there is still question of how to make variable projection be visible in the scope? 🤔