-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
27 lines (27 loc) · 839 Bytes
/
index.html
File metadata and controls
27 lines (27 loc) · 839 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
D3 Basic Test
</title>
<link rel="stylesheet" type="text/css" href="design.css">
<script type="text/javascript" src="d3/d3.js"></script>
</head>
<body>
<script type="text/javascript">
var dataset = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
d3.select("body").selectAll("p").data(dataset).enter().append("p").text(function(d){
return d;
});
d3.select("body").selectAll("p").style("color", function(d){
if (d % 20 == 0) {
return "red";
} else {
return "green";
}
});
d3.select("body")
</script>
</body>
</html>