-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut11-paths.html
58 lines (43 loc) · 1.02 KB
/
tut11-paths.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!doctype html>
<html>
<head>
<title>d3 test</title>
<script src="javascript/d3.min.js"></script>
</head>
<body>
<script>
var canvas = d3.select("body")
.append("svg")
.attr("width", 500)
.attr("height", 500);
group = canvas.append("g")
.attr("transform", "translate(250, 250)");
/*
//creating a line path
var data = [
{ x:20, y:50 },
{ x:40, y:80 },
{ x:90, y:20 }
];
var line = d3.svg.line()
.x(function(d) { return d.x })
.y(function(d) { return d.y });
var path = group.selectAll("path")
.data([data])
.enter()
.append("path")
.attr("d", line)
.attr("fill", "white")
.attr("stroke", "blue")
.attr("stroke-width", 15);
*/
var angle = 2 * Math.PI;
var arc = d3.svg.arc()
.innerRadius(100)
.outerRadius(150)
.startAngle(0)
.endAngle(angle);
var path = group.append("path")
.attr("d", arc)
</script>
</body>