1 |
33141
|
eri.katsar
|
<!DOCTYPE HTML>
|
2 |
|
|
<html>
|
3 |
|
|
<head>
|
4 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5 |
|
|
<title>Highcharts Example</title>
|
6 |
|
|
|
7 |
|
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
8 |
|
|
<script type="text/javascript">
|
9 |
|
|
$(function () {
|
10 |
|
|
var chart,
|
11 |
|
|
categories = ['0-4', '5-9', '10-14', '15-19',
|
12 |
|
|
'20-24', '25-29', '30-34', '35-39', '40-44',
|
13 |
|
|
'45-49', '50-54', '55-59', '60-64', '65-69',
|
14 |
|
|
'70-74', '75-79', '80-84', '85-89', '90-94',
|
15 |
|
|
'95-99', '100 +'];
|
16 |
|
|
$(document).ready(function() {
|
17 |
|
|
chart = new Highcharts.Chart({
|
18 |
|
|
chart: {
|
19 |
|
|
renderTo: 'container',
|
20 |
|
|
type: 'bar'
|
21 |
|
|
},
|
22 |
|
|
title: {
|
23 |
|
|
text: 'Population pyramid for Germany, midyear 2010'
|
24 |
|
|
},
|
25 |
|
|
subtitle: {
|
26 |
|
|
text: 'Source: www.census.gov'
|
27 |
|
|
},
|
28 |
|
|
xAxis: [{
|
29 |
|
|
categories: categories,
|
30 |
|
|
reversed: false
|
31 |
|
|
}, { // mirror axis on right side
|
32 |
|
|
opposite: true,
|
33 |
|
|
reversed: false,
|
34 |
|
|
categories: categories,
|
35 |
|
|
linkedTo: 0
|
36 |
|
|
}],
|
37 |
|
|
yAxis: {
|
38 |
|
|
title: {
|
39 |
|
|
text: null
|
40 |
|
|
},
|
41 |
|
|
labels: {
|
42 |
|
|
formatter: function(){
|
43 |
|
|
return (Math.abs(this.value) / 1000000) + 'M';
|
44 |
|
|
}
|
45 |
|
|
},
|
46 |
|
|
min: -4000000,
|
47 |
|
|
max: 4000000
|
48 |
|
|
},
|
49 |
|
|
|
50 |
|
|
plotOptions: {
|
51 |
|
|
series: {
|
52 |
|
|
stacking: 'normal'
|
53 |
|
|
}
|
54 |
|
|
},
|
55 |
|
|
|
56 |
|
|
tooltip: {
|
57 |
|
|
formatter: function(){
|
58 |
|
|
return '<b>'+ this.series.name +', age '+ this.point.category +'</b><br/>'+
|
59 |
|
|
'Population: '+ Highcharts.numberFormat(Math.abs(this.point.y), 0);
|
60 |
|
|
}
|
61 |
|
|
},
|
62 |
|
|
|
63 |
|
|
series: [{
|
64 |
|
|
name: 'Male',
|
65 |
|
|
data: [-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179,
|
66 |
|
|
-2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768,
|
67 |
|
|
-2176300, -1329968, -836804, -354784, -90569, -28367, -3878]
|
68 |
|
|
}, {
|
69 |
|
|
name: 'Female',
|
70 |
|
|
data: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
|
71 |
|
|
3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638,
|
72 |
|
|
1447162, 1005011, 330870, 130632, 21208]
|
73 |
|
|
}]
|
74 |
|
|
});
|
75 |
|
|
});
|
76 |
|
|
|
77 |
|
|
});
|
78 |
|
|
</script>
|
79 |
|
|
</head>
|
80 |
|
|
<body>
|
81 |
|
|
<script src="http://code.highcharts.com/highcharts.js"></script>
|
82 |
|
|
<script src="http://code.highcharts.com/modules/exporting.js"></script>
|
83 |
|
|
|
84 |
|
|
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
85 |
|
|
|
86 |
|
|
</body>
|
87 |
|
|
</html>
|