d3_contour library

d3-contour 4.0.2 in native, fully statically typed Dart with no Flutter import (ADR 0011, D3 ADR 0020).

Exports every pure file of the port without show/hide combinators so it compiles for the Dart VM, AOT, JavaScript, and WebAssembly.

Classes

ContourDensity<T>
A configurable 2D kernel density contour estimator for data of type T.
ContourMultiPolygon
A typed GeoJSON MultiPolygon contour geometry for a scalar value.
Contours
A configurable marching-squares contour polygon generator.
DensityContours
A reusable density contour evaluator returned by ContourDensity.contours.

Constants

d3ContourVersion → const String
The pinned upstream version of d3-contour.

Functions

buildDensityContoursBatch(List<double> values, int dx, int dy, List<double> outputThresholds, double thresholdScale, double coordScale, double coordOffset) → List<ContourMultiPolygon>
Internal fused helper used by density.dart to compute contours across outputThresholds (scaled by thresholdScale for marching squares) while fusing the affine (x * coordScale - coordOffset) transform into ring materialization and sharing one _StitchWorkspace.
buildDensityContourSingle(List<double> values, int dx, int dy, double gridValue, double outputValue, double coordScale, double coordOffset) → ContourMultiPolygon
Internal fused helper used by DensityContours.call to compute a single transformed density contour without allocating intermediate vertex lists.
contourArraySlice<T>(List<T> list, [int start = 0, int? end]) → List<T>
Returns a shallow copy of list, optionally sliced from start to end.
contourAscending(double a, double b) → int
Ascending numeric comparator for contour threshold sorting.
contourConstant<T>(T x) → T Function()
Returns a constant function that always returns x.
contourContains(List<(double, double)> ring, List<(double, double)> hole) → int
Tests whether ring contains hole.
contourDensity<T>({required DensityAccessor<T> x, required DensityAccessor<T> y, DensityAccessor<T>? weight, (num, num) size = (960, 500), num cellSize = 4, num? bandwidth, int? thresholdsCount, List<double>? thresholdsValues, ContourThresholdsValues? thresholdsGenerator, ContourThresholdsCount? thresholdsCountGenerator}) → ContourDensity<T>
Constructs a 2D kernel density estimator ContourDensity for arbitrary data elements of type T with explicit x and y accessors.
contourDensityPoints({DensityAccessor<(double, double)>? weight, (num, num) size = (960, 500), num cellSize = 4, num? bandwidth, int? thresholdsCount, List<double>? thresholdsValues, ContourThresholdsValues? thresholdsGenerator, ContourThresholdsCount? thresholdsCountGenerator}) → ContourDensity<(double, double)>
Constructs a 2D kernel density estimator ContourDensity for (double, double) point records with default x: (d) => d.$1 and y: (d) => d.$2 accessors.
contourNoop() → void
A no-op callback.
contourRingArea(List<(double, double)> ring) → double
Returns twice the signed area of a closed contour ring.
contours({(num, num) size = (1, 1), bool smooth = true, int? thresholdsCount, List<double>? thresholdsValues, ContourThresholdsValues? thresholdsGenerator, ContourThresholdsCount? thresholdsCountGenerator}) → Contours
Constructs a new marching-squares Contours generator.
maxValue(List<double> values) → double?
Calls d3-array's max without shadowing DensityContours.max.

Typedefs

ContourPoint = (double, double)
A 2D planar vertex (x, y) in a contour ring.
ContourPolygon = List<List<(double, double)>>
A polygon consisting of an exterior ring followed by zero or more hole rings.
ContourRing = List<(double, double)>
A closed contour ring of 2D planar vertices.
ContourThresholdsCount = int Function(List<double> values)
Callback computing an approximate threshold count from grid values.
ContourThresholdsValues = List<double> Function(List<double> values)
Callback computing explicit threshold values from grid values.
DensityAccessor<T> = double Function(T d)
A 1-argument numeric accessor for ContourDensity.
DensityIndexedAccessor<T> = double Function(T d, int index, Iterable<T> data)
A 3-argument indexed numeric accessor for ContourDensity.