Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.57 KB

symlog.md

File metadata and controls

31 lines (20 loc) · 1.57 KB

Symlog scales

See A bi-symmetric log transformation for wide-range data by Webber for details. Unlike a log scale, a symlog scale domain can include zero.

scaleSymlog(domain, range) {#scaleSymlog}

Examples · Source · Constructs a new continuous scale with the specified domain and range, the constant 1, the default interpolator and clamping disabled.

const x = d3.scaleSymlog([0, 100], [0, 960]);

If a single argument is specified, it is interpreted as the range. If either domain or range are not specified, each defaults to [0, 1].

const color = d3.scaleSymlog(["red", "blue"]) // default domain of [0, 1]

symlog.constant(constant) {#symlog_constant}

Examples · Source · If constant is specified, sets the symlog constant to the specified number and returns this scale. The constant defaults to 1.

const x = d3.scaleSymlog([0, 100], [0, 960]).constant(2);

If constant is not specified, returns the current value of the symlog constant.

x.constant() // 2