public abstract class ContinuousQuantitativeScale<S extends ContinuousQuantitativeScale<S>> extends QuantitativeScale<S>
QuantitativeScale
with a continuous range:
LinearScale
have a linear interpolator
LogScale
have apply a log function to the domain
PowScale
IdentityScale
TimeScale
are linear scale for timestamp
Modifier | Constructor and Description |
---|---|
protected |
ContinuousQuantitativeScale() |
Modifier and Type | Method and Description |
---|---|
boolean |
clamp()
returns whether or not the scale currently clamps values to within the
output range.
|
S |
clamp(boolean clamping)
Enables or disables clamping accordingly.
|
Value |
invert(double d)
Returns the value in the input domain x for the corresponding value in
the output range y.
|
S |
rangeRound(double... numbers)
|
S |
rangeRound(com.google.gwt.core.client.JavaScriptObject values)
Sets the scale's output range to the specified array of values, while
also setting the scale's interpolator to
D3#interpolateRound() . |
S |
rangeRound(String... numbers)
|
apply, apply, apply, copy, domain, domain, domain, domain, range, range, range, range
public final S rangeRound(com.google.gwt.core.client.JavaScriptObject values)
D3#interpolateRound()
.
This is a convenience routine for when the values output by the scale should be exact integers, such as to avoid antialiasing artifacts. It is also possible to round the output values manually after the scale is applied.
values
- the array of values.public final S rangeRound(double... numbers)
numbers
- public final S rangeRound(String... numbers)
numbers
- public final Value invert(double d)
This represents the inverse mapping from range to domain. For a valid value y in the output range, apply(scale.invert(y)) equals y; similarly, for a valid value x in the input domain, scale.invert(apply(x)) equals x.
Equivalently, you can construct the invert operator by building a new scale while swapping the domain and range. The invert operator is particularly useful for interaction, say to determine the value in the input domain that corresponds to the pixel location under the mouse.
Note: the invert operator is only supported if the output range is numeric! D3 allows the output range to be any type; under the hood, d3.interpolate or a custom interpolator of your choice is used to map the normalized parameter t to a value in the output range. Thus, the output range may be colors, strings, or even arbitrary objects. As there is no facility to "uninterpolate" arbitrary types, the invert operator is currently supported only on numeric ranges.
public final boolean clamp()
public final S clamp(boolean clamping)
By default, clamping is disabled, such that if a value outside the input domain is passed to the scale, the scale may return a value outside the output range through linear extrapolation.
For example, with the default domain and range of [0,1], an input value of 2 will return an output value of 2.
If clamping is enabled, the normalized domain parameter t is clamped to the range [0,1], such that the return value of the scale is always within the scale's output range.
Copyright © 2015 gwt-d3. All rights reserved.