Skip to content

Commit 71fecd0

Browse files
Fix chart render issue with other accordion plugins #813
1 parent d51357b commit 71fecd0

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

js/render-google.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ var __visualizer_chart_images = [];
319319
});
320320

321321
$('body').trigger('visualizer:chart:settings:extend', {id: id, chart: chart, settings: settings, data: table});
322-
323-
$( '.visualizer-hidden-container' ).css( 'display', 'block' ); // Temporary display chart to complete rendering.
324322
render.draw(table, settings);
325-
$( '.visualizer-hidden-container' ).removeAttr( 'style' ); // Remove temporary inline style.
326323
}
327324

328325
function format_data(id, table, type, format, index) {
@@ -365,7 +362,9 @@ var __visualizer_chart_images = [];
365362

366363
function render() {
367364
for (var id in (all_charts || {})) {
368-
renderChart(id);
365+
if (document.getElementById( id ).offsetParent !== null) {
366+
renderChart(id);
367+
}
369368
}
370369
}
371370

@@ -378,6 +377,12 @@ var __visualizer_chart_images = [];
378377
});
379378

380379
resizeHiddenContainers(true);
380+
381+
if ( $( '.visualizer-hidden-container' ).length ) {
382+
setInterval( function() {
383+
$( '.visualizer-hidden-container' ).find(".visualizer-front").resize();
384+
}, 500 );
385+
}
381386
});
382387

383388
$(window).on('load', function(){
@@ -457,10 +462,12 @@ var __visualizer_chart_images = [];
457462
callback: function () {
458463
gv = google.visualization;
459464
all_charts = v.charts;
460-
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
461-
renderChart(v.id);
462-
} else {
463-
render();
465+
if ( document.getElementById( v.id ).offsetParent !== null ) {
466+
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
467+
renderChart(v.id);
468+
} else {
469+
render();
470+
}
464471
}
465472
}
466473
});

0 commit comments

Comments
 (0)