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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
| <!DOCTYPE HTML>
| <html>
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
| <title>Highcharts Example</title>
|
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
| <script type="text/javascript">
| $(function () {
| var chart,
| categories = ['0-4', '5-9', '10-14', '15-19',
| '20-24', '25-29', '30-34', '35-39', '40-44',
| '45-49', '50-54', '55-59', '60-64', '65-69',
| '70-74', '75-79', '80-84', '85-89', '90-94',
| '95-99', '100 +'];
| $(document).ready(function() {
| $('#container').highcharts({
| chart: {
| type: 'bar'
| },
| title: {
| text: 'Population pyramid for Germany, midyear 2010'
| },
| subtitle: {
| text: 'Source: www.census.gov'
| },
| xAxis: [{
| categories: categories,
| reversed: false
| }, { // mirror axis on right side
| opposite: true,
| reversed: false,
| categories: categories,
| linkedTo: 0
| }],
| yAxis: {
| title: {
| text: null
| },
| labels: {
| formatter: function(){
| return (Math.abs(this.value) / 1000000) + 'M';
| }
| },
| min: -4000000,
| max: 4000000
| },
|
| plotOptions: {
| series: {
| stacking: 'normal'
| }
| },
|
| tooltip: {
| formatter: function(){
| return '<b>'+ this.series.name +', age '+ this.point.category +'</b><br/>'+
| 'Population: '+ Highcharts.numberFormat(Math.abs(this.point.y), 0);
| }
| },
|
| series: [{
| name: 'Male',
| data: [-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179,
| -2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768,
| -2176300, -1329968, -836804, -354784, -90569, -28367, -3878]
| }, {
| name: 'Female',
| data: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
| 3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638,
| 1447162, 1005011, 330870, 130632, 21208]
| }]
| });
| });
|
| });
| </script>
| </head>
| <body>
| <script src="../../js/highcharts.js"></script>
| <script src="../../js/modules/exporting.js"></script>
|
| <div id="container" style="min-width: 400px; max-width: 800px; height: 400px; margin: 0 auto"></div>
|
| </body>
| </html>
|
|