forked from Giorgi/TbilisiFloodDonations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
61 lines (55 loc) · 1.76 KB
/
app.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
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
var app = {
chart: null,
initialize: function () {
if (app.chart === null) {
app.chart = $('#container');
}
app.chart.text('Loading...');
},
loadData: function (callback) {
$.getJSON('data.json', callback);
},
render: function () {
app.loadData(function (response) {
app.chart.highcharts({
tooltip: {
useHTML: true,
formatter: function () {
var result = '<b style="font-size:16px"><a target="_blank" href="' + this.point.info.url + '">' + this.point.name + '</a>' + ' - ' + this.point.value + ' 000 ლარი</b>';
result += '<br/>';
result += '<br/>';
result += '<img src="' + this.point.info.logo + '"></img>';
return result;
}
},
series: [{
type: 'treemap',
alternateStartingDirection: true,
layoutAlgorithm: 'squarified',
levels: [{
level: 1,
dataLabels: {
style: {
fontSize: '16px'
}
}
}],
data: response.data
}],
title: {
text: ''
}, credits: {
enabled: false
}
});
});
}
};
$(function () {
if (window.location.host == 'giorgi.github.io') {
window.location = "http://tbilisiflood.info/";
return;
}
app.initialize();
app.render();
});