I’m using the HighStock stock charting library to generate a basic OHLC stock chart. I want to perform some action when the chart is generated (and after it’s regenerated by changing the displayed time frame). I’m trying to do this using the plotOptions.ohlc.events.show event (documentation).
The problem I’m having is the even isn’t firing at all. If I follow the example for the click event, the alert fires correctly when I click the series.
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'divChart',
height: 450
},
rangeSelector: {
selected: 2
},
xAxis: {
maxZoom: 14 * 24 * 3600000
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 250,
height: 100,
offset: 0,
lineWidth: 2
}],
title: {
text: 'Stock Chart'
},
series: [{
type: 'ohlc',
name: 'Prices',
id: 'prices',
data: ohlc
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1
}],
// The event I am trying to bind to
plotOptions: {
series: {
events: {
show: function () {
alert("show");
}
}
}
}
});
- Is this the correct way to fire an event when the chart is redrawn?
- If so, why isn’t the event firing, and how do I fix it?
Change the chart part to something similar
They’ve got a nice API browser – might come in handy
http://www.highcharts.com/ref/#chart-events–load