d3 / d3-contour

Compute contour polygons using marching squares.

Home Page:https://d3js.org/d3-contour

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected data generated on empty or non-visible datasets

nyurik opened this issue · comments

As described in vega/vega#1149 , when d3-contour gets an empty data, it generates a very large dataset of unexpected values. See also @jheer 's comment. Thanks!

Sorry, but I don’t understand what you are asking. The contours method expects an n×m array as input; you’re not supposed to pass it an empty array. If you do, it is equivalent to the values in the grid being undefined (or equivalently NaN), and all NaN values are considered to not pass the threshold test. Which seems to work fine:

https://beta.observablehq.com/@mbostock/empty-contour-test