Javascript HighChart Age/Name Example
Example using age as a measuring value with High Cart in Javascript
by Risa Esfahani
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Age of Major Life Events'
},
subtitle: {
text: 'Created By: <a href="http://www.rocketrisa.com">Rocket Risa</a>'
},
xAxis: {
categories: ['John', 'Jane', 'Jessica', 'Jordan', 'Jeri'],
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Age (years)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' years'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 80,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
credits: {
enabled: false
},
series: [{
name: 'Teen',
data: [15, 13, 18, 14, 17]
}, {
name: 'Young Adult',
data: [23, 28, 21, 25, 27]
}, {
name: 'Middle Age 30+',
data: [35, 46, 32, 64, 51]
}]
});
});