dv_scale library

Scale functions for data visualization.

Classes

BandScale<T>
A band scale maps discrete domain values to a continuous range with bands.
ColorSchemes
Standard categorical color schemes.
ContinuousScale<D extends num, R>
Base class for continuous scales that map a continuous domain to a range.
DivergingLogScale<R>
Diverging scale with log transform.
DivergingPowScale<R>
Diverging scale with power transform.
DivergingScale<R>
A diverging scale maps a continuous domain with a midpoint to an interpolator.
LinearScale
A linear scale maps a continuous domain to a continuous range using linear interpolation.
LogScale
A logarithmic scale applies a log transform to the domain.
OrdinalScale<D, R>
An ordinal scale maps discrete domain values to discrete range values.
PointScale<T>
A point scale maps discrete domain values to points within a continuous range. Similar to band scale but with zero bandwidth.
PowerScale
A power scale applies an exponential transform to the domain.
QuantileScale<R>
A quantile scale maps a sampled domain to discrete range values based on quantiles.
QuantizeScale<R>
A quantize scale maps a continuous domain to discrete range values.
SequentialLogScale<R>
Sequential scale with log transform.
SequentialPowScale<R>
Sequential scale with power transform.
SequentialScale<R>
A sequential scale maps a continuous domain to a color scheme using an interpolator.
SymlogScale
A symmetric log scale that handles both positive and negative values. Uses the bi-symmetric log transform: sign(x) * log(1 + |x / constant|)
ThresholdScale<D extends Comparable<D>, R>
A threshold scale maps values to discrete outputs based on threshold values.
TimeScale
A time scale maps DateTime values to a continuous range.

Functions

interpolateRange<T>(double t, T start, T end, Interpolator<T> interpolatorFactory(T, T)) → T
Helper to interpolate within a range.
linearTickFormat(double start, double stop, int count, [String? specifier]) String Function(double)
Creates a tick format function.
linearTicks(double start, double stop, [int count = 10]) List<double>
Generates tick values for a linear scale.
logTicks(double start, double stop, int count, [double base = 10]) List<double>
Generates tick values for a log scale.
niceNumber(double x, {bool round = false}) double
Nice number calculation for axis ticks.
niceTicks(double start, double stop, int count) List<double>
Adjusts ticks for nice round values.
normalize(num value, num min, num max) double
Helper to normalize a value within a domain.
rescale(double t, double oMin, double oMax, double nMin, double nMax) double
Rescales a value from one domain/range to another.
scaleBand<T>({List<T>? domain, List<double>? range, double paddingInner = 0, double paddingOuter = 0, double padding = 0, double align = 0.5, bool round = false}) BandScale<T>
Creates a band scale.
scaleDiverging<R>({List<double>? domain, required Interpolator<R> interpolator, bool clamp = false}) DivergingScale<R>
Creates a diverging scale.
scaleLinear({List<double>? domain, List<double>? range, bool clamp = false}) LinearScale
Creates a linear scale with the given domain and range.
scaleLog({List<double>? domain, List<double>? range, bool clamp = false, double base = 10}) LogScale
Creates a log scale with base 10.
scaleOrdinal<D, R>({List<D>? domain, List<R>? range, R? unknown}) OrdinalScale<D, R>
Creates an ordinal scale.
scalePoint<T>({List<T>? domain, List<double>? range, double padding = 0, double align = 0.5, bool round = false}) PointScale<T>
Creates a point scale.
scalePow({List<double>? domain, List<double>? range, bool clamp = false, double exponent = 1}) PowerScale
Creates a power scale.
scaleQuantile<R>({List<double>? domain, required List<R> range}) QuantileScale<R>
Creates a quantile scale.
scaleQuantize<R>({List<double>? domain, required List<R> range}) QuantizeScale<R>
Creates a quantize scale.
scaleSequential<R>({List<double>? domain, required Interpolator<R> interpolator, bool clamp = false}) SequentialScale<R>
Creates a sequential scale.
scaleSqrt({List<double>? domain, List<double>? range, bool clamp = false}) PowerScale
Creates a square root scale (power scale with exponent 0.5).
scaleSymlog({List<double>? domain, List<double>? range, bool clamp = false, double constant = 1}) SymlogScale
Creates a symlog scale.
scaleThreshold<D extends Comparable<D>, R>({required List<D> domain, required List<R> range}) ThresholdScale<D, R>
Creates a threshold scale.
scaleTime({List<DateTime>? domain, List<double>? range, bool clamp = false}) TimeScale
Creates a time scale.
tickIncrement(int start, int stop, int count) int
Calculates tick increment for integer values.
tickStep(double start, double stop, int count) double
Calculates the step size for tick generation.