-
Notifications
You must be signed in to change notification settings - Fork 0
/
bubble_graph_test.html
203 lines (182 loc) · 9.46 KB
/
bubble_graph_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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html lang="en">
<head>
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<title>Raphael Test</title>
<script type="text/javascript" src="raphael-min.js"></script>
<!--<script type="text/javascript" src="https://raw.github.com/Guamaso/BubbleGraph/master/bubble_graph.js"></script>-->
<script type="text/javascript" src="bubble_graph.js"></script>
<style>
body {font-family: 'Architects Daughter', cursive;}
h1 {}
#skillz {border: 1px solid #dddddd; background-color: #EDECD1; margin: 20px;}
</style>
</head>
<body>
<h1>Bubble Graph Test</h1>
<p>Bubble Graph is a wrapper for RaphealJS that makes creating a bubble chart a little easier. Currently alpha. ;)</p>
<div id="familia"></div>
<p>Personal skill assessment, 2013</p>
<div id="skillz"></div>
<ul>
<li>The line thickness represents my skill level.</li>
<li>The distance between me and the subject represents my interest level.</li>
<li>The size of the circle represents how much time I get to spend on that subject.</li>
<li>Brown are client side languages, blue are server side languages, purple are DB languages (ish).</li>
</ul>
<p>Code:</p>
<pre>
var R2 = Raphael( "skillz", 800, 550)
//Bubble Graph creates it's own instance of Raphael if you don't pass it.
var skillz = new Bubble_Graph(R2);
//Create Me bubble
//declares the options required for the bubble
opts = { "xx":300, "yy": 300, "r":80, "out_text" : "Juan Orozco\nDeveloper", "font_size" : "16px", "fill_color" : "#3C7531"};
//creates the bubble
skillz.create_bubble( "juan", opts );
//create all of my interests (subjects)
opts = { "xx":290, "yy": 140, "r":50, "out_text" : "JavaScript", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "js", opts );
opts = { "xx":200, "yy": 50, "r":35, "out_text" : "jQuery / \njQuery UI", "font_size" : "10px", "fill_color" : "#543626"};
skillz.create_bubble( "jquery", opts );
opts = { "xx":328, "yy": 55, "r":20, "out_text" : "Node\nJS", "font_size" : "10px", "fill_color" : "#543626"};
skillz.create_bubble( "nodejs", opts );
opts = { "xx":175, "yy": 180, "r":35, "out_text" : "HTML", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "html", opts );
opts = { "xx":145, "yy": 267, "r":30, "out_text" : "CSS", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "css", opts );
opts = { "xx":520, "yy": 208, "r": 60, "out_text" : "PHP", "font_size" : "14px", "fill_color" : "#264454" };
skillz.create_bubble( "php", opts );
opts = { "xx":710, "yy": 328, "r": 20, "out_text" : "Dot Net\n(ASP, VB)", "font_size" : "8px", "fill_color" : "#264454" };
skillz.create_bubble( "net", opts );
opts = { "xx":380, "yy": 160, "r": 25, "out_text" : "Ruby", "font_size" : "14px", "fill_color" : "#264454" };
skillz.create_bubble( "ruby", opts );
opts = { "xx":430, "yy": 135, "r":25, "out_text" : "Ruby \non Rails", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "rails", opts );
opts = { "xx":690, "yy": 380, "r":20, "out_text" : "Python", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "python", opts );
opts = { "xx":760, "yy": 280, "r":20, "out_text" : "Pascal \n/Delphi", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "pascal", opts );
opts = { "xx":500, "yy": 500, "r": 20, "out_text" : "T-SQL", "font_size" : "10px", "fill_color" : "#4D2654" };
skillz.create_bubble( "tsql", opts );
opts = { "xx":280, "yy": 480, "r": 50, "out_text" : "MySQL", "font_size" : "14px", "fill_color" : "#4D2654" };
skillz.create_bubble( "mysql", opts );
opts = { "xx":200, "yy": 400, "r": 25, "out_text" : "Neo4J", "font_size" : "13px", "fill_color" : "#4D2654" };
skillz.create_bubble( "neo4j", opts );
opts = { "xx":720, "yy": 480, "r": 50, "out_text" : "4D\n(SQL)", "font_size" : "13px", "fill_color" : "#4D2654" };
skillz.create_bubble( "4d", opts );
opts = { "xx":110, "yy": 380, "r": 50, "out_text" : "R", "font_size" : "14px", "fill_color" : "#4D2654" };
skillz.create_bubble( "r", opts );
//Connect all the things
skillz.connect_bubble("juan",["js","php","mysql"], { "line_weight" : "20px"});
skillz.connect_bubble("juan",["css","html","pascal","tsql","4d"], { "line_weight" : "10px"});
skillz.connect_bubble("juan",["r","net"], { "line_weight" : "5px"});
skillz.connect_bubble("juan",["ruby","python","neo4j"], { "line_weight" : "2px"});
//connect all the sub things
skillz.connect_bubble("js", "jquery", { "line_weight" : "18px"});
skillz.connect_bubble("js", "nodejs", { "line_weight" : "5px"});
skillz.connect_bubble("ruby", "rails", { "line_weight" : "1px"});
</pre>
<script type="text/javascript">
function set_up( resp )
{
var R = Raphael( "familia", 600, 600)
var my_family = new Bubble_Graph(R);
console.log( resp );
console.log( "Creating shapes" );
opts = { "xx":80, "yy": 200, "r":60, "out_text" : "Juan", "font_size" : "16px", "fill_color" : "#2EC953"};
my_family.create_bubble( "juan", opts );
opts = { "xx":300, "yy": 200, "r":60, "out_text" : "Ciri", "font_size" : "16px", "fill_color" : "#A82EC9"};
my_family.create_bubble( "ciri", opts );
opts = { "xx":150, "yy": 50, "r":40, "out_text" : "Jonas"};
my_family.create_bubble( "dood", opts );
opts = { "xx":150, "yy": 350, "r":40, "out_text" : "Izabella"};
my_family.create_bubble( "bean", opts );
opts = { "xx":500, "yy": 400, "r":20, "out_text" : "Timber"};
my_family.create_bubble( "the_dog", opts );
//to create connections, there are a few ways...
//The all-in-one-shot way...
opts =
{
"sets":
[
{
"parent":"ciri"
, "children":["bean","dood"]
, "attrs" :
{
"line_weight" : "5px"
,"stroke_color" : "#721E8A"
}
}
,{
"parent":"juan"
, "children":["ciri"]
, "attrs" :
{
"line_weight" : "10px"
}
}
]
};
my_family.connect_bubble( opts );
//one set at a time way...
my_family.connect_bubble("juan",["bean","dood"]);
//and the one connection at a time way...
my_family.connect_bubble("ciri","the_dog");
}
//trigger process
set_up('');
var R2 = Raphael( "skillz", 800, 550)
//Bubble Graph creates it's own instance of Raphael if you don't pass it.
var skillz = new Bubble_Graph(R2);
//Create Me bubble
//declares the options required for the bubble
opts = { "xx":300, "yy": 300, "r":80, "out_text" : "Juan Orozco\nDeveloper", "font_size" : "16px", "fill_color" : "#3C7531"};
//creates the bubble
skillz.create_bubble( "juan", opts );
//create all of my interests (subjects)
opts = { "xx":290, "yy": 140, "r":50, "out_text" : "JavaScript", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "js", opts );
opts = { "xx":200, "yy": 50, "r":35, "out_text" : "jQuery / \njQuery UI", "font_size" : "10px", "fill_color" : "#543626"};
skillz.create_bubble( "jquery", opts );
opts = { "xx":328, "yy": 55, "r":20, "out_text" : "Node\nJS", "font_size" : "10px", "fill_color" : "#543626"};
skillz.create_bubble( "nodejs", opts );
opts = { "xx":175, "yy": 180, "r":35, "out_text" : "HTML", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "html", opts );
opts = { "xx":145, "yy": 267, "r":30, "out_text" : "CSS", "font_size" : "14px", "fill_color" : "#543626"};
skillz.create_bubble( "css", opts );
opts = { "xx":520, "yy": 208, "r": 60, "out_text" : "PHP", "font_size" : "14px", "fill_color" : "#264454" };
skillz.create_bubble( "php", opts );
opts = { "xx":710, "yy": 328, "r": 20, "out_text" : "Dot Net\n(ASP, VB)", "font_size" : "8px", "fill_color" : "#264454" };
skillz.create_bubble( "net", opts );
opts = { "xx":380, "yy": 160, "r": 25, "out_text" : "Ruby", "font_size" : "14px", "fill_color" : "#264454" };
skillz.create_bubble( "ruby", opts );
opts = { "xx":430, "yy": 135, "r":25, "out_text" : "Ruby \non Rails", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "rails", opts );
opts = { "xx":690, "yy": 380, "r":20, "out_text" : "Python", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "python", opts );
opts = { "xx":760, "yy": 280, "r":20, "out_text" : "Pascal \n/Delphi", "font_size" : "10px", "fill_color" : "#264454" };
skillz.create_bubble( "pascal", opts );
opts = { "xx":500, "yy": 500, "r": 20, "out_text" : "T-SQL", "font_size" : "10px", "fill_color" : "#4D2654" };
skillz.create_bubble( "tsql", opts );
opts = { "xx":280, "yy": 480, "r": 50, "out_text" : "MySQL", "font_size" : "14px", "fill_color" : "#4D2654" };
skillz.create_bubble( "mysql", opts );
opts = { "xx":200, "yy": 400, "r": 25, "out_text" : "Neo4J", "font_size" : "13px", "fill_color" : "#4D2654" };
skillz.create_bubble( "neo4j", opts );
opts = { "xx":720, "yy": 480, "r": 50, "out_text" : "4D\n(SQL)", "font_size" : "13px", "fill_color" : "#4D2654" };
skillz.create_bubble( "4d", opts );
opts = { "xx":110, "yy": 380, "r": 50, "out_text" : "R", "font_size" : "14px", "fill_color" : "#4D2654" };
skillz.create_bubble( "r", opts );
//Connect all the things
skillz.connect_bubble("juan",["js","php","mysql"], { "line_weight" : "20px"});
skillz.connect_bubble("juan",["css","html","pascal","tsql","4d"], { "line_weight" : "10px"});
skillz.connect_bubble("juan",["r","net"], { "line_weight" : "5px"});
skillz.connect_bubble("juan",["ruby","python","neo4j"], { "line_weight" : "2px"});
//connect all the sub things
skillz.connect_bubble("js", "jquery", { "line_weight" : "18px"});
skillz.connect_bubble("js", "nodejs", { "line_weight" : "5px"});
skillz.connect_bubble("ruby", "rails", { "line_weight" : "1px"});
</script>
</body>
</html>