JavaScript
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container',
type: 'column',
panning: false,
zoomType: 'x',
events: {
selection: function (e) {
var xAxis = e.xAxis[0],
flag = false; // first selected point, should deselect old ones
if(xAxis) {
$.each(this.series, function (i, series) {
$.each(series.points, function (j, point) {
if( point.x >= xAxis.min && point.x <= xAxis.max ) {
point.select(true, flag);
if (!flag) {
flag = !flag;
}
}
});
});
}
return false; // prevent zoom
}
}
},
rangeSelector: {
selected: 1
},
navigator: {
series: {
type: 'column',
color: 'yellow',
},
xAxis: {
labels: {
formatter: function() {
return this.value;
}
}
}
},
title: {
text: 'AAPL Stock Price'
},
series: [{
name: 'AAPL',
data: [47, 21, 8, 60, 76, 81, 35, 22, 39, 34, 2, 87, 84, 32, 51, 24, 99, 30, 36, 71, 48, 50, 61, 79, 55, 56, 53, 4, 12, 29, 9, 82, 44, 64, 57, 94, 45, 31, 63, 14, 42, 65, 3, 38, 80, 33, 25, 96, 27, 86, 18, 49, 77, 46, 1, 83, 20, 91, 43, 7, 59, 6, 54, 41, 93, 40, 11, 5, 98, 66, 23, 75, 78, 69, 89, 85, 13, 58, 37, 70, 10, 16, 74, 95, 73, 28, 92, 72, 19, 26, 90, 15, 68, 88, 67, 62, 17, 52, 97, 12],
tooltip: {
valueDecimals: 2
}
}],
xAxis: {
tickWidth: 0,
lineWidth: 0,
gridLineWidth: 0,
tickPixelInterval: 100,
...