blob: 941d5bb6bddf69792bb9f6080dbe7fa5034e9a17 (
plain)
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
|
define(['campus-coords', 'd3'], function(coords, d3) {
'use strict';
var imageUrl = 'images/campus.jpg';
function initSvg(svg) {
svg
.attr('width', 1280)
.attr('height', 893);
svg.append('image')
.attr('xlink:href', imageUrl)
.attr('width', 1280)
.attr('height', 893);
svg.append('g')
.selectAll('polygon')
.data(coords)
.enter()
.append('a')
.attr('xlink:href', function(d) {
return '#/campus/' + d.name;
})
.append('polygon')
.attr('class', 'building')
.attr('points', function(d) {
return d.coords.join(' ');
})
.append('title')
.text(function(d) {
return d.name;
});
}
return function() {
var svg = d3.select('#campus-map').append('svg');
initSvg(svg);
};
});
|