Chapter 3: Population Graph 65 and Over (3)
X axis year number using pointStart in series option.
This can be fixed by overwriting labels.formatter function by just returning this.value
HTML
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<body>
<div style="margin: 5px 60px 5px 5px; " id='container'></div>
</body>
JavaScript
$(document).ready(function() {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
},
title: {
text: 'Population ages 65 and over (% of total)',
},
credits: {
position: {
align: 'left',
x: 20
},
text: 'Data from The World Bank'
},
xAxis: {
labels: {
formatter: function() {
return this.value;
}
}
},
yAxis: {
title: {
text: 'Percentage %',
}
},
series: [{
pointStart: 1980,
name: 'Japan - 65 and over',
data: [9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14,
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 23]}]
});
});