Skip to content

Documentation / @ripl/charts / createValueScale

Function: createValueScale() ​

createValueScale(options, domain, range): Scale<number>

Defined in: charts/src/core/scales.ts:87

Builds a value-axis Scale from resolved axis options over a data extent and pixel range.

The scale family is chosen from options.scale ('log', 'pow', 'sqrt', or the default 'linear'). An explicit min/max overrides the corresponding end of the data extent and is respected exactly; otherwise the domain is niced to tick-aligned bounds unless nice is false.

Parameters ​

ParameterTypeDescription
optionsChartAxisItemOptionsThe resolved axis options (scale type, nice, ticks, min/max, base/exponent).
domainnumber[]The data extent [min, max] the values span.
rangenumber[]The pixel range [start, end] the scale maps onto.

Returns ​

Scale<number>

A numeric scale mapping domain to range.