Is there any onReady
(or similar) ready event for HighCharts?
Currently, HighCharts only offers addSeries
, click
, load
This is definitely less elegant than the accepted answer, but still works fine with a few lines of code. The essence is to simply poll all chart container HTML elements.
The code below assumes you have one or more Highcharts attached to elements having class="chart":
var chartsToLoad = [];
$('.chart').each(function(n,elem) {
chartsToLoad[n] = window.setInterval(function() {
if(typeof($(elem).highcharts()) !== 'undefined') {
// It's loaded now, go ahead...
$(elem).highcharts().doSomeHighchartsStuffHere()
// Permanently stop polling
window.clearInterval(chartsToLoad[n]);
}
}, 100); // Check every 100ms
});