This repository has been archived by the owner on Aug 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<html> | ||
<head> | ||
|
||
<script type="text/javascript" nonce="fdbbae9b177249bca1e964453ce" src="//local.adguard.org?ts=1615019388436&type=content-script&dmn=bl.ocks.org&app=com.apple.Safari&css=1&js=1&gcss=1&rel=1&rji=1&sbe=0&stealth=1&uag="></script> | ||
<script type="text/javascript" nonce="fdbbae9b177249bca1e964453ce" src="//local.adguard.org?ts=1615019388436&name=AdGuard%20Extra&type=user-script"></script></head> | ||
|
||
<body> | ||
<script src="https://d3js.org/d3.v3.min.js"></script> | ||
<script type="text/javascript"> | ||
//The data for our line | ||
const lineData = []; | ||
|
||
for (let i = 0; i < 256; i++) { | ||
lineData.push({ | ||
x: 100 * Math.cos((15 * 2 * 3.14159 * i) / 180) + 125, | ||
y: 100 * Math.sin((16 * 2 * 3.14159 * i) / 180) + 125, | ||
}); | ||
} | ||
|
||
console.log(lineData.length) | ||
console.table(lineData) | ||
|
||
//This is the accessor function we talked about above | ||
const lineFunction = d3.svg | ||
.line() | ||
.x(function (d) { | ||
return d.x; | ||
}) | ||
.y(function (d) { | ||
return d.y; | ||
}) | ||
.interpolate('curveCatmullRom'); | ||
|
||
//The SVG Container | ||
const svgContainer = d3 | ||
.select('body') | ||
.append('svg') | ||
.attr('width', 300) | ||
.attr('height', 300); | ||
|
||
//The line SVG Path we draw8 | ||
const lineGraph = svgContainer | ||
.append('path') | ||
.attr('d', lineFunction(lineData)) | ||
.attr('stroke', 'blue') | ||
.attr('stroke-width', 2) | ||
.attr('fill', 'none'); | ||
</script> | ||
</body> | ||
|
||
</html> |