-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
92 lines (83 loc) · 1.97 KB
/
script.js
File metadata and controls
92 lines (83 loc) · 1.97 KB
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
var w = 500,
h = 500;
var colorscale = d3.scale.category10();
//Legend titles
var LegendOptions = [
// 'COBIT5',
'ISO 27002',
'ITIL'
];
//Data
var d = [
[
{ axis: "EDM", value: 3/5 },
{ axis: "APO", value: 7/13 },
{ axis: "BAI", value: 40/68 },
{ axis: "DSS", value: 5/6 },
{ axis: "MEA", value: 3/3 },
],
[
{ axis: "EDM", value: 3/5 },
{ axis: "APO", value: 10/13 },
{ axis: "BAI", value: 12/27 },
{ axis: "DSS", value: 1/1 },
{ axis: "MEA", value: 1/1 },
]
];
//Options for the Radar chart, other than default
var mycfg = {
w: w,
h: h,
maxValue: 0.6,
levels: 6,
ExtraWidthX: 300
}
//Call function to draw the Radar chart
//Will expect that data is in %'s
RadarChart.draw("#chart", d, mycfg);
////////////////////////////////////////////
/////////// Initiate legend ////////////////
////////////////////////////////////////////
var svg = d3.select('#body')
.selectAll('svg')
.append('svg')
.attr("width", w + 300)
.attr("height", h)
//Create the title for the legend
var text = svg.append("text")
.attr("class", "title")
.attr('transform', 'translate(90,0)')
.attr("x", w - 70)
.attr("y", 10)
.attr("font-size", "12px")
.attr("fill", "#404040")
.text("% Cumplimiento con los dominios de COBIT5");
//Initiate Legend
var legend = svg.append("g")
.attr("class", "legend")
.attr("height", 100)
.attr("width", 200)
.attr('transform', 'translate(90,20)')
;
//Create colour squares
legend.selectAll('rect')
.data(LegendOptions)
.enter()
.append("rect")
.attr("x", w - 65)
.attr("y", function (d, i) { return i * 20; })
.attr("width", 10)
.attr("height", 10)
.style("fill", function (d, i) { return colorscale(i); })
;
//Create text next to squares
legend.selectAll('text')
.data(LegendOptions)
.enter()
.append("text")
.attr("x", w - 52)
.attr("y", function (d, i) { return i * 20 + 9; })
.attr("font-size", "11px")
.attr("fill", "#737373")
.text(function (d) { return d; })
;