var diffMove = 200;
var btnLeft = $('#btnLeft');
if (btnLeft.length > 0) {
btnLeft.click(function () {
var chart = $('#container').highcharts();
var pos = chart.xAxis[0].getExtremes();
if (pos.min - diffMove < pos.dataMin) {
chart.xAxis[0].setExtremes(pos.dataMin, pos.max - pos.min, true, true);
}
else
chart.xAxis[0].setExtremes(pos.min - diffMove, pos.max - diffMove, true, true);
});
}
var btnRight = $('#btnRight');
if (btnRight.length > 0) {
btnRight.click(function () {
var chart = $('#container').highcharts();
var pos = chart.xAxis[0].getExtremes();
if (pos.max + diffMove > pos.dataMax) {
chart.xAxis[0].setExtremes(pos.min + (pos.dataMax - pos.max), pos.dataMax, true, true);
}
else
chart.xAxis[0].setExtremes(pos.min + diffMove, pos.max + diffMove, true, true);
});
}
var btnBottom = $('#btnBottom');
if (btnBottom.length > 0) {
btnBottom.click(function () {
var chart = $('#container').highcharts();
var pos = chart.yAxis[0].getExtremes();
//console.log('before : ',chart.yAxis[0].getExtremes());
if (pos.max + diffMove < pos.dataMax) {
chart.yAxis[0].setExtremes(pos.min + diffMove, pos.max + diffMove, true, true);
}
else
chart.yAxis[0].setExtremes(pos.min + (pos.dataMax - pos.max), pos.dataMax, true, true);
//console.log('after : ', chart.yAxis[0].getExtremes());
});
}
var btnTop = $('#btnTop');
if (btnTop.length > 0) {
btnTop.click(function () {
var chart = $('#container').highcharts();
var pos = chart.yAxis[0].getExtremes();
//console.log('before : ', chart.yAxis[0].getExtremes());
if (pos.min - diffMove > pos.dataMin) {
chart.yAxis[0].setExtremes(pos.min - diffMove, pos.max - diffMove, true, true);
}
else
chart.yAxis[0].setExtremes(pos.dataMin, pos.max + (pos.dataMin - pos.min), true, true);
//console.log('after : ', chart.yAxis[0].getExtremes());
});
}