Most helpers exposed in this addon are prefixed with p/
, for example: p/sample
.
This is to avoid name clashes with other addons and helpers you may already be using.
The extent helper is used for finding the min and max values of an array of sorted data to be used as the input to the domain of a scale.
There are 3 ways to use this addon:
let data = [1,2,3,4,5]
let data = [{x:1,y:2},{x:2,y:2},{x:3,y:2},{x:4,y:2},{x:5,y:2}]
let data = [[1,2],[2,2],[3,2],[4,2],[5,2]]
{{p/scale-linear (p/extent values key="$0")}}
In this example, we're sending the extent of values for the x
axis to the
scale-linear
helper.
Constructs an accessor function for fetching values from a collection.
An optional transform helper can be applied as the second argument which will be
applied to each returned value. See p/transform-date
Maps values from a collection using the supplied map helper function.
Returns the scaled value from a given scale.
Transform helpers provide a simple way to convert values on the fly before passing them down to another component.
Returns a function which transforms unix timestamps to Date objects.