這個d3.brushX()函數在D3.js中用於使用新的一維畫筆x-尺寸。
用法:
d3.brushX();
參數:該函數不接受任何參數。
返回值:此函數沿x軸返回新創建的一維筆刷
例:在此示例中,我們將使用此方法在SVG元素上創建一維畫筆和大小為600×600像素的x軸畫筆。
HTML
<!DOCTYPE html>
<html>
<head>
<title>
D3.js | d3.brushX() Function
</title>
<script src =
"https://d3js.org/d3.v4.min.js">
</script>
</head>
<body>
<svg width=600 height=600 id="brush"></svg>
<script>
// Selecting SVG element
d3.select("#brush")
// Creating a brush along x-axis
// using the d3.brush function
.call( d3.brushX()
// Initialise the brush area:start at
// 0,0 and finishes at given width,height
.extent( [ [0,0], [600,600] ] )
)
</script>
</body>
</html>
輸出:
相關用法
- d3.js d3.set.add()用法及代碼示例
- PHP min( )用法及代碼示例
- p5.js nfc()用法及代碼示例
- CSS var()用法及代碼示例
- PHP Ds\Set add()用法及代碼示例
- p5.js nf()用法及代碼示例
- p5.js arc()用法及代碼示例
- CSS url()用法及代碼示例
- PHP Ds\Map get()用法及代碼示例
- PHP key()用法及代碼示例
- PHP next()用法及代碼示例
- PHP pos()用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- PHP each()用法及代碼示例
- p5.js box()用法及代碼示例
注:本文由純淨天空篩選整理自taran910大神的英文原創作品 D3.js brushX() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。