-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion-2.js
69 lines (68 loc) · 2.29 KB
/
question-2.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
62
63
64
65
66
67
68
69
/* url to fetch json location */
asean_url = '/datasets/json/asean-population.json';
$(document).ready(function () {
fetch(asean_url).then((response) => {
if (response.ok) {
return response.json();
} else {
throw new Error('Something went wrong');
}
})
.then((asean_responseJson) => {
Highcharts.chart('highchart-graph-2', {
chart: {
type: 'column'
},
title: {
text: 'Population of ASEAN countries for the year 2014'
},
subtitle: {
text: 'Source: <a href="https://datahub.io/core/population-growth-estimates-and-projections/r/population-estimates.csv">World Population</a>'
},
xAxis: {
title: {
text: 'Years'
},
type: 'category',
labels: {
rotation: -45,
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: 'Population'
}
},
legend: {
enabled: false
},
tooltip: {
pointFormat: 'Population in 2014: <b>{point.y}</b>'
},
series: [{
name: 'Population',
data: asean_responseJson,
dataLabels: {
enabled: true,
rotation: 0,
color: '#FFFFFF',
align: 'center',
format: '{point.y}', // one decimal
y: 10, // 10 pixels down from the top
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
}
}]
});
})
.catch((error) => {
console.log(error)
});
});