Domain helpers
getValueDomain ⇒ Array.<number>
Builds the domain for a value axis so that it always contains zero.
Charts whose marks grow from a baseline need that baseline inside the domain, otherwise a negative value scales to a coordinate outside the range and the mark is drawn with a negative width or height, which SVG rejects.
For data that is entirely non-negative this returns [0, max].
Kind: global constant
Returns: Array.<number> - [lower, upper], always spanning zero
| Param | Type | Description |
|---|---|---|
| values | Iterable.<number> | Values the axis has to cover |
| ratio | number | Headroom multiplier applied to the extent |
| emptyDomainMax | number | Upper bound to use when every value is 0 |
getBaselineExtent ⇒ Object
Where a mark that grows from the zero baseline starts, and how long it is.
Works for either axis: with a vertical scale start is a y and size a
height, with a horizontal one they are an x and a width. Negative values come
back on the other side of the baseline with a positive size, which is what
SVG needs.
scale is typed structurally, as the number-to-number function this
actually calls it as, rather than as a d3 ScaleLinear. That is both
narrower about what is required and wider about what satisfies it: any of
d3's continuous scales fits, and the helper never touches the rest of a
scale's surface.
Kind: global constant
Returns: Object - Where the mark starts and how long it is
| Param | Type | Description |
|---|---|---|
| scale | function | Linear scale for the value axis |
| value | number | Value to place |