-
Notifications
You must be signed in to change notification settings - Fork 6
/
demo_chart.html
144 lines (125 loc) · 5.32 KB
/
demo_chart.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
<!DOCTYPE HTML>
<html>
<head>
<title>Example Graph</title>
<script src="../libs/jquery-1.4.2.js" ></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script src="../csster.js" type="text/javascript"></script>
<script type="text/javascript">
$.fn.bubbleChart = function (options) {
Csster.style({
'table.bubble_chart': {
position: 'relative',
padding: 10,
td: {
div: {
has: Csster.macros.roundedCorners(15),
height: 30,
width: 30,
overflow: 'hidden',
backgroundColor: 'white',
verticalAlign: 'middle',
textAlign: 'center'
}
},
thead: {
td: {
zIndex: 100,
padding: '0 0 20px 0',
color: 'white',
fontSize: 9,
fontFamily: 'verdana',
textAlign: 'center',
div: {
marginLeft: 18
}
}
},
tbody: {
td: {
verticalAlign: 'bottom'
}
},
th: {
color: 'white',
fontSize: 9,
fontFamily: 'verdana'
}
}
});
var $this = $(this);
var $graph = $('<table><thead><tr></tr><tr></tr></thead><tbody><tr></tr></tbody><tfoot><tr></tr></tfoot></table>').addClass('bubble_chart').appendTo($this);
var $tfoot = $graph.find('tfoot tr');
var $tbody = $graph.find('tbody tr');
$graph.css('backgroundColor', 'black');
var count = 0;
for (d in options.data) count++;
$graph.css('width', count * 30);
var $thead = $graph.find('thead tr:last');
for (var cat in options.colors) {
var $div = $('<div>').css('backgroundColor', options.colors[cat] || 'gray');
$('<td colspan="2">').text(cat).append($div).appendTo($thead);
}
for (var k in options.data) {
var bucket = options.data[k];
$('<th>').text(k).appendTo($tfoot);
var $td = $('<td>').appendTo($tbody);
var items = Csster.arrayFlatten([bucket]);
for (var i = items.length - 1; i >= 0; i--) {
$('<div>').attr('title', items[i]).css('backgroundColor', options.colors[items[i]] || 'gray').appendTo($td);
}
}
};
$(function () {
$('div').bubbleChart({
data: {
// '1983-1984': 'Basic',
// 1985: 'Fortran',
// '1986-1989': 'C',
// '1990-1992': 'C++',
1993: 'Obj.Pascal',
1994: 'Obj.Pascal',
1995: 'Obj.Pascal',
1996: 'Obj.Pascal',
1997: 'Obj.Pascal',
1998: 'Obj.Pascal',
1999: 'Obj.Pascal',
2000: ['PHP', 'C++'],
2001: ['SQL', 'PHP', 'C++'],
2002: ['Java', 'SQL', 'CSS', 'PHP', 'C++', 'TCL/tk'],
2003: ['Java', 'SQL', 'CSS', 'Perl', 'PHP'],
2004: ['Java', 'SQL', 'CSS', 'Perl', 'XML/XSLT'],
2005: ['Java', 'SQL', 'CSS', 'Javascript', 'Perl', 'XML/XSLT'],
2006: ['Java', 'SQL', 'CSS', 'Javascript', 'Perl', 'XML/XSLT'],
2007: ['Java', 'SQL', 'CSS', 'Javascript', 'XML/XSLT'],
2008: ['Ruby', 'Java', 'SQL', 'CSS', 'Javascript', 'XML/XSLT'],
2009: ['Ruby', 'Java', 'SQL', 'CSS', 'Javascript', 'XML/XSLT'],
2010: ['Ruby', 'Javascript', 'SQL', 'CSS', 'XML/XSLT'],
2011: ['Ruby', 'Javascript', 'SQL', 'CSS'],
2012: ['Ruby', 'Javascript', 'SQL', 'CSS'],
2013: ['Ruby', 'Javascript', 'SQL', 'CSS'],
2014: ['Ruby', 'Javascript', 'SQL', 'CSS'],
2015: ['Ruby', 'Javascript', 'SQL', 'CSS']
}, colors: {
'C': 'LightSkyBlue',
'C++': 'DarkBlue',
'PHP': '#669', // from PHP.net
'Java': '#0c60ae', // blue from the logo
'Javascript': 'MediumVioletRed',
'Ruby': '#b61414', // from ruby crystal icon
'Obj.Pascal': 'MediumPurple',
'Perl': 'Wheat',
'SQL': '#e97b00', // from Mysql.org site
'XML/XSLT': 'olive',
'CSS': 'Gold',
'Other': 'gray'
}
});
});
</script>
</head>
<body>
<h1>Programming Languages / Andrew J. Peterson</h1>
<div></div>
</body>
</html>