domain property

  1. @override
List<num> get domain
inherited

The scale's domain that specifies the input values.

The list must contain two or more elements. Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. For example, to create a diverging color scale that interpolates between white and red for negative values, and white and green for positive values, say:

var color = ScaleLinear(
  domain: [-1, 0, 1],
  range: ["red", "white", "green"],
  interpolate: interpolateRgb,
);

color(-0.5); // "rgb(255, 128, 128)"
color(0.5); // "rgb(128, 192, 128)"

Internally, a piecewise scale performs a binary search (see bisectRight) for the range interpolator corresponding to the given domain value. Thus, the domain must be in ascending or descending order. If the domain and range have different lengths N and M, only the first min(N,M) elements in each are observed.

Implementation

@override
List<X> get domain => _domain.sublist(0);
  1. @override
set domain (List<num> domain)
inherited

Implementation

@override
set domain(List<X> domain) {
  _domain = List<X>.of(domain);
  _rescale();
}