Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
46
rated 0 times [  52] [ 6]  / answers: 1 / hits: 82049  / 13 Years ago, sat, january 21, 2012, 12:00:00

How do I redraw/rescale a google linechart on window resize?


More From » jquery

 Answers
34

To redraw only when the window resize is completed and avoid multiple triggers, I think is better create an event:



//create trigger to resizeEnd event     
$(window).resize(function() {
if(this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function() {
$(this).trigger('resizeEnd');
}, 500);
});

//redraw graph when window resize is completed
$(window).on('resizeEnd', function() {
drawChart(data);
});

[#87879] Friday, January 20, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tiasavannahw

Total Points: 448
Total Questions: 122
Total Answers: 113

Location: Maldives
Member since Tue, Dec 21, 2021
3 Years ago
;