-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.js
29 lines (26 loc) · 926 Bytes
/
ui.js
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
var showInfo = function () {
console.log('showInfo: data not ready...');
};
$(document).ready(function () {
var $infoPanel = $('<div class="info-panel">').appendTo('body');
var infoPanel = new InfoPanel($infoPanel);
infoPanel
.textProps(['Property Name', 'Type'])
.numericProps(['Rank', 'Floor Area', 'ENERGY STAR Score', 'Site EUI'])
.colorProperty('Type');
$.getJSON('./data/buildings.json', function (data) {
var buildingsById = {};
data.forEach(function (building, i) {
buildingsById[building.ID] = building;
});
showInfo = function (id) {
if (!id) {
infoPanel.showProperties({});
return;
}
var building = buildingsById[id];
var type = building.ID.split('_')[0];
infoPanel.showProperties(building, typeColors[type]);
};
});
});