-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.html
97 lines (50 loc) · 1.62 KB
/
variables.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
</svg>
<!-- JAVASCRIPT BÖRJAR HÄR -->
<script src="lib/underscore.js"></script>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script type="text/javascript">
var listOfCities =
[
{"name":"Stockholm","formed":1250,"isCapital":"true", pop: 1000000},
{"name":"Göteborg","formed":1621,"isCapital":"false", pop: 500000},
{"name":"Gävle","formed":1446,"isCapital":"false", pop: 150000},
];
var storleksSkalan = d3.scale.sqrt()
.domain([150000, 1000000])
.range([20, 100])
var svg = d3.select("svg");
var circles = svg.selectAll("circle")
.data(listOfCities);
circles.enter()
.append("circle")
circles.attr("r", function(item){
return storleksSkalan(item.pop);
})
.attr("fill", "red")
.attr("stroke", "black")
.attr("cx", function (item, index){
return index * 200;
})
.attr("cy", 300)
/*var city1 = {
name : "Stockholm",
formed : 1250,
isCapital : true,
districts : ["Akalla", "Bagarmossen"]
};
var city2 = {
name : "Borås",
formed : 1650,
isCapital : false,
districts : []
};*/
// Demonstrera Objekt
// Demonstrera Funktion
// Demonstrera "Dataset" - Excel
/* Workshop */
</script>