Class pv.Scale.root
Extends
pv.Scale.quantitative.
Represents a root scale; a function that performs a power
transformation. Most
commonly, a root scale represents a 1-dimensional root transformation from a
numeric domain of input data [d0, d1] to
a numeric range of pixels [r0, r1].
Note that the scale is itself a function, and thus can be used as a property directly, assuming that the data associated with a mark is a number. While this is convenient for single-use scales, frequently it is desirable to define scales globally:
var y = pv.Scale.root(0, 100).range(0, 640);The y scale can now be equivalently referenced within a property:
.height(function(d) y(d))Alternatively, if the data are not simple numbers, the appropriate value can be passed to the y scale (e.g., d.foo). The #by method similarly allows the data to be mapped to a numeric value before performing the root transformation.
Defined in: RootScale.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Returns a root scale for the specified domain.
|
Method Attributes | Method Name and Description |
---|---|
power(v)
Sets or gets the exponent; defaults to 2.
|
- Methods borrowed from class pv.Scale.quantitative:
- by, domain, invert, nice, range, tickFormat, ticks
Class Detail
pv.Scale.root()
Returns a root scale for the specified domain. The arguments to this
constructor are optional, and equivalent to calling #domain.
The default domain and range are [0,1].
- Parameters:
- {number...} domain...
- optional domain values.
Method Detail
{pv.Scale.root}
power(v)
Sets or gets the exponent; defaults to 2.
- Parameters:
- {number} v Optional
- the new exponent.
- Returns:
- {pv.Scale.root} this, or the current base.