Skip to content
Snippets Groups Projects
Commit 7ce67cd0 authored by Nathan Haug's avatar Nathan Haug
Browse files

Issue #2202425 by bryanlburkholder and quicksketch: Support for window...

Issue #2202425 by bryanlburkholder and quicksketch: Support for window resizing event in Google Charts.
parent 3f1cc89c
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,20 @@ Drupal.behaviors.chartsGoogle.attach = function(context, settings) {
google.load('visualization', '1', { callback: renderCharts });
}
// Redraw charts on window resize.
var debounce;
$(window).resize(function() {
clearTimeout(debounce);
debounce = setTimeout(function() {
$('.charts-google').each(function() {
var wrap = $(this).data('chartsGoogleWrapper');
if (wrap) {
wrap.draw(this);
}
});
}, 75);
});
function renderCharts() {
$('.charts-google').once('charts-google', function() {
if ($(this).attr('data-chart')) {
......@@ -84,6 +98,7 @@ Drupal.behaviors.chartsGoogle.attach = function(context, settings) {
}
wrap.draw(this);
$(this).data('chartsGoogleWrapper', wrap);
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment