Highcharts Stock Demo
author(s):
Torstein Hønsi
by Chitkala More
HTML
<div id="container" style="height: 400px; min-width: 600px; max-width: 800px; margin: 0 auto"></div>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
JavaScript
$(function () {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) {
// Create the chart
$('#container').highcharts('StockChart', {
exporting: {
buttons: {
contextButton: {
enabled: false
},
toggle: {
align: 'left',
y: 20,
height: 18,
theme: {
'stroke-width': 1,
stroke: 'silver',
r: 0
},
text: 'Select range',
menuItems: [{
text: '2007-2010',
onclick: function () {
this.xAxis[0].setExtremes(Date.UTC(2007, 0, 1), Date.UTC(2010, 0, 1));
}
}, {
text: '2010-2013',
onclick: function () {
this.xAxis[0].setExtremes(Date.UTC(2010, 0, 1), Date.UTC(2013, 0, 1));
}
}]
}
}
},
rangeSelector: {
enabled: false
},
title: {
text: 'AAPL Stock Price'
},
subtitle: {
text: 'Custom data grouping tied to range selector'
},
series: [{
name: 'AAPL',
data: data,
marker: {
enabled: null, // auto
radius: 3,
lineWidth: 1,
lineColor: '#FFFFFF'
},
tooltip: {
valueDecimals: 2
}
}]
});
...