Skip to content

Type Alias: FillRule ​

ts
type FillRule = 'simple' | 'evenodd' | 'nonzero' | 'intersect';

Experimental

How rings combine into a filled region.

  • 'simple' (default): earcut fast path. First ring outer, others holes; rings are assumed simple and non-overlapping (GeoJSON / shapefile semantics). Use for choropleths, treemaps, stacked areas, shapes. Self-intersecting rings give undefined (but bounded) output.
  • 'evenodd': exact even-odd rule over all rings of the polygon, including self-intersecting and overlapping rings (Plotly "toself" pentagram → hollow center). CPU planar arrangement; see fill-arrangement.ts for cost and limits.
  • 'nonzero': exact nonzero-winding rule (SVG default); same machinery as 'evenodd'. Holes must be wound opposite to their outer ring to be cut.
  • 'intersect': filled where the winding number is at least 2, i.e. the intersection of two nonzero regions whose outer rings run counter-clockwise and holes clockwise (each winding 0 or 1): contour fills clipped to a data mask. Same machinery as 'nonzero'.

Released under the MIT License.