I'm trying to make the X and Y axes of my chart intersect at 0, always. Currently, I'm intercepting the 'load' event and then changing the offset of the axes which works initially, but when the window is resized or the chart is zoomed in, the axes don't update.
How can I keep the axes centred on 0 even when the window is resized or the chart zoomed?
Here's my fiddle and code: http://jsfiddle.net/a003mc4b/
$(function () {
$('#container').highcharts({
chart: {
type: 'scatter',
zoomType: 'xy',
events: {
load : function() {
this.xAxis[0].update({
offset: -this.yAxis[0].translate(0)
});
this.yAxis[0].update({
offset: -this.xAxis[0].translate(0)
});
}
},
},
title: {
text: 'X and Y axis should intersect at 0'
},
yAxis: {
lineColor: '#FF0000',
lineWidth: 1
},
xAxis: {
lineColor: '#FF0000',
lineWidth: 1
},
series: [{
data: [[0,0],[1,1],[2,5],[-1,-5],[0,5]]
}]
});
});