Symlog 比例尺
請參閱 Webber 的 雙對稱對數轉換,適用於廣泛資料 以取得詳細資訊。與 對數比例尺 不同,symlog 比例尺的定義域可以包含零。
scaleSymlog(domain, range)
範例 · 原始碼 · 建立一個新的連續比例尺,具有指定的 定義域 和 範圍,常數 1,預設 內插器 和 鎖定 已停用。
js
const x = d3.scaleSymlog([0, 100], [0, 960]);
如果指定單一引數,則會將其解釋為 範圍。如果 定義域 或 範圍 沒有指定,則各自預設為 [0, 1]。
js
const color = d3.scaleSymlog(["red", "blue"]) // default domain of [0, 1]
symlog.constant(constant)
範例 · 原始碼 · 如果指定 constant,則將 symlog 常數設定為指定的數字並傳回此比例尺。常數預設為 1。
js
const x = d3.scaleSymlog([0, 100], [0, 960]).constant(2);
如果未指定 constant,則傳回 symlog 常數的目前值。
js
x.constant() // 2