Skip to main content

Constants

getValueDomainArray.<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 the same [0, max] the charts used before, so nothing about existing charts changes.

getBaselineExtentObject

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.

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 the same [0, max] the charts used before, so nothing about existing charts changes.

Kind: global constant
Returns: Array.<Number> - [lower, upper], always spanning zero

ParamTypeDescription
valuesArray.<Number>Values the axis has to cover
ratioNumberHeadroom multiplier applied to the extent
emptyDomainMaxNumberUpper 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.

Kind: global constant
Returns: Object - { start, size }

ParamTypeDescription
scalefunctionLinear scale for the value axis
valueNumberValue to place