-
Notifications
You must be signed in to change notification settings - Fork 1
/
index-e1.html
76 lines (70 loc) · 3.66 KB
/
index-e1.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ejemplo #1</title>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<style>
.going-down { color: red; }
.going-up { color: green; }
.cool { font-weight: bold; font-size: 120%; }
</style>
</head>
<body>
<main class="container">
<div class="row">
<div class="col-xs-12">
<h1>Ejemplo #1</h1>
<p>Selecciones y Data Joins</p>
</div>
<section class="col-xs-12">
<h2>Lenguajes de Programación</h2>
<div class="first-data-driven-viz"></div>
</section>
</div>
</main>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/lodash/lodash.min.js"></script>
<script src="node_modules/d3/build/d3.min.js"></script>
<script>
$(function()
{
"use strict";
// http://www.tiobe.com/tiobe-index/
var progLang = [
{ oct16: 1, oct15: 1, lang: 'Java', ratings: 18.799, change: -0.74, },
{ oct16: 2, oct15: 2, lang: 'C', ratings: 9.835, change: -6.35, },
{ oct16: 3, oct15: 3, lang: 'C++', ratings: 5.797, change: +0.05, },
{ oct16: 4, oct15: 4, lang: 'C#', ratings: 4.367, change: -0.46, },
{ oct16: 5, oct15: 5, lang: 'Python', ratings: 3.775, change: -0.74, },
{ oct16: 6, oct15: 8, lang: 'JavaScript', ratings: 2.751, change: +0.46, },
{ oct16: 7, oct15: 6, lang: 'PHP', ratings: 2.741, change: +0.18, },
{ oct16: 8, oct15: 7, lang: 'Visual Basic .NET', ratings: 2.660, change: +0.20, },
{ oct16: 9, oct15: 9, lang: 'Perl', ratings: 2.495, change: +0.25, },
{ oct16: 10, oct15: 14, lang: 'Objective-C', ratings: 2.263, change: +0.84, },
{ oct16: 11, oct15: 12, lang: 'Assembly language', ratings: 2.232, change: +0.66, },
{ oct16: 12, oct15: 15, lang: 'Swift', ratings: 2.004, change: +0.73, },
{ oct16: 13, oct15: 10, lang: 'Ruby', ratings: 2.001, change: +0.18, },
{ oct16: 14, oct15: 13, lang: 'Visual Basic', ratings: 1.987, change: +0.47, },
{ oct16: 15, oct15: 11, lang: 'Delphi/Object Pascal', ratings: 1.875, change: +0.24, },
{ oct16: 16, oct15: 65, lang: 'Go', ratings: 1.809, change: +1.67, },
{ oct16: 17, oct15: 32, lang: 'Groovy', ratings: 1.769, change: +1.19, },
{ oct16: 18, oct15: 20, lang: 'R', ratings: 1.741, change: +0.75, },
{ oct16: 19, oct15: 17, lang: 'MATLAB', ratings: 1.619, change: +0.46, },
{ oct16: 20, oct15: 18, lang: 'PL/SQL', ratings: 1.531, change: +0.46, },
];
progLang = _.reject(progLang, { lang: 'PHP' });
var chart = d3.select('.first-data-driven-viz');
var ul = chart.append('ul');
var items = ul.selectAll('li.lang').data(progLang);
items.enter().append('li')
.attr('class', 'lang')
.classed('cool', function(d) { return d.ratings > 3; })
.classed('going-down', function(d) { return d.oct16 < d.oct15; })
.classed('going-up', function(d) { return d.oct16 > d.oct15;})
.style('font-size', function(d) { return (((20-d.oct16) * 2) + 5) + 'px'; })
.text(function(d) { return d.lang; });
});
</script>
</body>
</html>