d4_scale library
Scales map a dimension of abstract data to a visual representation.
Although most often used for encoding data as position, say to map time and temperature to a horizontal and vertical position in a scatterplot, scales can represent virtually any visual encoding, such as color, stroke width, or symbol size. Scales can also be used with virtually any type of data, such as named categorical data or discrete data that requires sensible breaks.
For color schemes, see d4_scale_chromatic.
Classes
-
Scale<
X, Y> - A generic mapper from an input domain to an output range.
-
ScaleBand<
X> Band scales - Band scales are like ordinal scales except the output range is continuous and numeric.
-
ScaleDiverging<
Y> Diverging scales - Diverging scales are similar to linear scales, but the input domain and output range always have exactly three elements.
-
ScaleDivergingLog<
Y> Diverging scales - A diverging scale with a logarithmic transform, analogous to ScaleLog.
-
ScaleDivergingPow<
Y> Diverging scales - A diverging scale with an exponential transform, analogous to a ScalePow.
-
ScaleDivergingSymlog<
Y> Diverging scales - A diverging scale with a logarithmic transform, analogous to a ScaleSymlog.
- ScaleIdentity Linear scales
- Identity scales are a special case of linear scales where the domain and range are identical.
-
ScaleLinear<
Y> Linear scales -
Linear scales map a continuous, quantitative input
domain
to a continuous outputrange
using a linear transformation (translate and scale). -
ScaleLog<
Y> Log scales - Logarithmic (“log”) scales are like linear scales except that a logarithmic transform is applied to the input domain value before the output range value is computed.
-
ScaleOrdinal<
X, Y> Ordinal scales - Unlike continuous scales, ordinal scales have a discrete domain and range.
-
ScalePoint<
X> Point scales - Point scales are a variant of band scales with the bandwidth fixed to zero.
-
ScalePow<
Y> Pow scales - Power (“pow”) scales are similar to linear scales, except an exponential transform is applied to the input domain value before the output range value is computed.
-
ScaleQuantile<
Y> Quantile scales - Quantile scales map a sampled input domain to a discrete range.
-
ScaleQuantize<
Y> Quantize scales - Quantize scales are similar to linear scales, except they use a discrete rather than continuous range.
- ScaleRadial Linear scales
- Radial scales are a variant of linear scales where the range is internally squared so that an input value corresponds linearly to the squared output value.
-
ScaleSequential<
Y> Sequential scales - Sequential scales are similar to linear scales, but the input domain and output range always have exactly three elements.
-
ScaleSequentialLog<
Y> Sequential scales - A sequential scale with a logarithmic transform, analogous to ScaleLog.
-
ScaleSequentialPow<
Y> Sequential scales - A sequential scale with an exponential transform, analogous to a ScalePow.
-
ScaleSequentialQuantile<
Y> Sequential scales - A sequential scale with a p-quantile transform, analogous to a ScaleQuantile.
-
ScaleSequentialSymlog<
Y> Sequential scales - A sequential scale with a logarithmic transform, analogous to a ScaleSymlog.
-
ScaleSymlog<
Y> Symlog scales - See A bi-symmetric log transformation for wide-range data by Webber for details. Unlike a ScaleLog, a symlog scale domain can include zero.
-
ScaleThreshold<
X, Y> Threshold scales - Threshold scales are similar to quantize scales, except they allow you to map arbitrary subsets of the domain to discrete values in the range.
-
ScaleTime<
Y> Time scales - Time scales are a variant of linear scales that have a temporal domain.
Extensions
-
ScaleContinuousNumberExtension
on ScaleContinuousBase<
X, num> - Adds invert and rangeRound methods to continuous scales with numeric range.
-
ScaleDivergingNumberExtension
on ScaleDiverging<
num> - Adds rangeRound method to diverging scales with numeric range.
-
ScaleSequentialNumberExtension
on ScaleSequential<
num> - Adds rangeRound method to sequential scales with numeric range.
Functions
-
tickFormat(
num start, num stop, num count, [String? specifier]) → String Function(num) Linear scales -
Returns a
number format
function suitable for displaying a tick value, automatically computing the
appropriate precision based on the fixed interval between tick values, as
determined by
tickStep
.