-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
43 lines (38 loc) · 1.09 KB
/
test.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
<!DOCTYPE html>
<html>
<head>
<!-- <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js">
</script> -->
<script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
</head>
<body>
<div id="data_example3"></div>
<script type="text/javascript">
circleData = [
[10, "rgb(246, 239, 247)"],
[15, "rgb(189,201,225)"],
[20, "rgb(103,169,207)"],
[25, "rgb(28,144,153)"],
[30, "rgb(1,108,89)"]
];
var selectDiv = d3.select("#data_example3")
.append("svg:svg")
.attr("width", circleData.length * 100)
.attr("height", 100);
selectDiv.selectAll("circle")
.data(circleData)
.enter()
.append("circle")
.attr("cx", function(d) {
return d[0] * 14
})
.attr("cy", 50)
.attr("r", function(d) {
return d[0]
})
.style("fill", function(d) {
return d[1]
});
</script>
</body>
</html>