larsvers / d3-hexgrid

Regular hexagon tessellation with edge cover detection.
BSD 3-Clause "New" or "Revised" License
153 stars 17 forks source link

Reduce decimal places of `hexRadius` config internally #2

Closed larsvers closed 5 years ago

larsvers commented 5 years ago

The point density calculation partly breaks when a floating number with more than one decimal place is passed to .hexRadius. extentPointDensity[1] returns NaN and consequently extentPointsWeighted returns [NaN, NaN]. As a temporary work around, instead of:

d3.hexgrid()
  // ...
  .hexRadius(4.5678)

use

d3.hexgrid()
  // ...
  .hexRadius(Math.round(4.5678 * 10) / 10)