1
0
mirror of https://github.com/d3/d3.git synced 2025-12-08 19:46:24 +00:00
d3/docs/d3-scale/symlog.md
Philippe Rivière 1497db2b2f
more anchor fixes & restructure API/geo (#3662)
* more fixes

* remove raw

* restructure API/geo

* fix broken headers
2023-06-09 14:22:35 +00:00

1.6 KiB

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)

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)

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