JWin
Posts: 9
Joined: Wed Jan 11, 2012 9:35 pm

Performance recommendation for window resize reflow

In the initReflow function you have an event listener for the window resizing to reflow the layout of the charts. The attempt was made to prevent the resize function from running with every firing of the resize event but it makes more sense to "debounce" the event so the reflow function itself doesn't even fire and run through its logic until the window has stopped resizing. This will also prevent an issue I saw where the actual resizing of the charts was always one event behind the window size (in Chrome specifically, I fixed the issue before I even bothered testing other browsers so I'm unsure of their behavior).

Here's a write up (and code example) on debouncing: http://unscriptable.com/index.php/2009/ ... t-methods/

I've been using Paul Irish's smartresize jQuery plugin (http://paulirish.com/2009/throttled-sma ... t-handler/) for this task in my app and that's how I've patched the Highcharts code for the time being, but you guys will likely want to roll a custom solution to keep the cross-js framework flexibility.

Return to “Highcharts Usage”