d3.symbolSquare屬性是D3.js中的符號類型。它是一個 square-shaped可以使用的符號類型。
用法:
d3.symbolSquare
範例1:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src=
"https://d3js.org/d3.v5.min.js">
</script>
</head>
<body>
<h1 style="text-align:center; color:green;">
GeeksforGeeks
</h1>
<h3 style="text-align:center;">
D3.js | symbolSquare
</h3>
<center>
<svg id="gfg" width="100" height="100"></svg>
</center>
<script>
// symbolSquare
var sym = d3.symbol()
.type(d3.symbolSquare).size(500);
d3.select("#gfg")
.append("path")
.attr("d", sym)
.attr("fill", "green")
.attr("transform", "translate(50,50)");
</script>
</body>
</html>
輸出:
範例2:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src=
"https://d3js.org/d3.v5.min.js">
</script>
</head>
<body>
<h1 style="text-align:center; color:green;">
GeeksforGeeks
</h1>
<h3 style="text-align:center;">
D3.js | symbolSquare
</h3>
<center>
<svg id="gfg" width="100" height="100"></svg>
</center>
<script>
// symbolSquare
var sym = d3.symbol()
.type(d3.symbolSquare).size(500);
d3.select("#gfg")
.append("path")
.attr("d", sym)
.attr("fill", "none")
.attr("stroke","green")
.attr("stroke-width","5px")
.attr("transform", "translate(50,50)");
</script>
</body>
</html>
輸出:
相關用法
- d3.js Symbols symbolDiamond用法及代碼示例
- d3.js Symbols symbolCross用法及代碼示例
- CSS transition-property用法及代碼示例
- HTML DOM lang用法及代碼示例
- HTML Style backgroundClip用法及代碼示例
- HTML Style borderTop用法及代碼示例
- HTML Meter max用法及代碼示例
- HTML Input Hidden value用法及代碼示例
- CSS table-layout用法及代碼示例
- CSS text-align用法及代碼示例
- CSS border-top-width用法及代碼示例
- HTML Textarea autofocus用法及代碼示例
- HTML Style columnGap用法及代碼示例
- HTML Input Time autofocus用法及代碼示例
- HTML Input Submit formTarget用法及代碼示例
- HTML Style boxSizing用法及代碼示例
- HTML Input Checkbox disabled用法及代碼示例
- CSS isolation屬性用法及代碼示例
- HTML Input Range max用法及代碼示例
- HTML Video loop用法及代碼示例
- HTML Button disabled用法及代碼示例
注:本文由純淨天空篩選整理自taran910大神的英文原創作品 D3.js Symbols symbolSquare Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。