Skip to content

Instantly share code, notes, and snippets.

@webapprentice
Created November 7, 2013 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webapprentice/7359836 to your computer and use it in GitHub Desktop.
Save webapprentice/7359836 to your computer and use it in GitHub Desktop.
Use the highcharts.js JavaScript library to display a graph in a page
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width: 800px; height: 400px; margin: 0 auto; border: 1px solid black;"></div>
<script>
$(function () {
$('#container').highcharts({
title: {
text: 'Registered Syrian Refugees',
},
subtitle: {
text: 'Source: UNHCR',
},
xAxis: {
title: {
text: 'Month'
},
categories: [
'2012-02', '2012-04', '2012-06', '2012-08', '2012-10', '2012-12',
'2013-02', '2013-04', '2013-06', '2013-08', '2013-10' ]
},
yAxis: {
title: {
text: 'Number of Refugees'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}],
min: 0
},
legend: {
enabled: false
},
series: [{
name: 'Refugees',
data: [ 21767, 52931, 92597, 190658, 290357, 471808,
743122, 1216708, 1529140, 1805453, 2079112 ]
}]
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment