Skip to content

Instantly share code, notes, and snippets.

@mattsigal
Last active December 25, 2015 21:19
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 mattsigal/7041796 to your computer and use it in GitHub Desktop.
Save mattsigal/7041796 to your computer and use it in GitHub Desktop.
Highcharts
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/highcharts-more.js' type='text/javascript'></script>
<script src='http://code.highcharts.com/modules/exporting.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 500px;
}
</style>
</head>
<body>
<div id='hchart1' class='rChart highcharts'></div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "hchart1",
"width": 800,
"height": 500,
"credits": {
"href": null,
"text": null
},
"exporting": {
"enabled": true
},
"title": {
"text": "Smoking and Exercise"
},
"yAxis": [
{
"title": "Count"
}
],
"chart": {
"type": "column",
"renderTo": "hchart1"
},
"plotOptions": {
"column": {
"stacking": "normal"
}
},
"xAxis": [
{
"title": "Category",
"categories": [ "No Exercising", "Some Exercising", "Frequent Exercising" ]
}
],
"series": [
{
"name": "Non-Smoker",
"data": [
18,
84,
87
]
},
{
"name": "Occasional Smoker",
"data": [
3,
4,
12
]
},
{
"name": "Regular Smoker",
"data": [
1,
7,
9
]
},
{
"name": "Heavy Smoker",
"data": [
1,
3,
7
]
}
],
"id": "hchart1"
});
});
})(jQuery);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment