Instantly share code, notes, and snippets.

@mohhasbias /.block
Last active Feb 26, 2017

Embed
What would you like to do?
SVG line using D3
license: mit

Membuat SVG line elemen dengan menggunakan D3.

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<div id="d3-drawing-area"></div>
<script>
var svg = d3.select('#d3-drawing-area').append('svg')
.attr('width', 300)
.attr('height', 300)
.style('background', 'lightblue');
var line = svg.append('line')
.attr('x1', 100)
.attr('y1', 100)
.attr('x2', 200)
.attr('y2', 200)
.style('stroke', 'blue');
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment