Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ScaleLinear

A linear continuous scale defined over a numeric domain.

Continuous scales map a continuous, quantitative input domain to a continuous output range. Each range value y can be expressed as a function of the domain value x: y = mx + b.

If the range is also numeric, the mapping may be inverted.

Note that the data types of the range and output of the scale must be compatible with the interpolator applied by the scale.

The first generic corresponds to the data type of the range elements.

The second generic corresponds to the data type of the output elements generated by the scale.

The third generic corresponds to the data type of the unknown value.

If range element and output element type differ, the interpolator factory used with the scale must match this behavior and convert the interpolated range element to a corresponding output element.

interface ScaleLinear <Range, Output, Unknown = never> extends ScaleContinuousNumeric<Range, Output, Unknown> {
interpolate(): InterpolatorFactory<any, any>;
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput, Unknown>;
unknown(): UnknownReturnType<Unknown, undefined>;
unknown<NewUnknown>(value: NewUnknown): ScaleLinear<Range, Output, NewUnknown>;
}

§Type Parameters

§
Range
[src]
§
Output
[src]
§
Unknown = never
[src]

§Extends

§
ScaleContinuousNumeric<Range, Output, Unknown>
[src]

§Methods

§
interpolate(): InterpolatorFactory<any, any>
[src]

Returns the scale’s current interpolator factory, which defaults to interpolate.

§
interpolate(interpolate: InterpolatorFactory<Range, Output>): this
[src]

Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range.

Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.

As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.

@param interpolate

An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.

§
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput, Unknown>
[src]

Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range.

Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.

As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.

The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.

@param interpolate

An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.

§
unknown(): UnknownReturnType<Unknown, undefined>
[src]

Returns the current unknown value, which defaults to undefined.

§
unknown<NewUnknown>(value: NewUnknown): ScaleLinear<Range, Output, NewUnknown>
[src]

Sets the output value of the scale for undefined (or NaN) input values and returns this scale.

@param value

The output value of the scale for undefined (or NaN) input values.