Skip to content

Commit

Permalink
Merge pull request #1074 from Codeinwp/fix/charts-on-tabs
Browse files Browse the repository at this point in the history
[Fix] Render the charts that are in hidden containers
  • Loading branch information
vytisbulkevicius authored Feb 6, 2024
2 parents e6a9d10 + 46c8376 commit 0add303
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions js/render-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,18 @@ var vizClipboard1=null;
function displayChartsOnFrontEnd() {

$('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){
if ( $(element).is(':visible') ) {
var id = $(element).addClass('viz-facade-loaded').attr('id');
setTimeout(function(){
// Add a short delay between each chart to avoid overloading the browser event loop.
showChart(id);
}, ( index + 1 ) * 100);

// Do not render charts that are intentionally hidden.
var style = window.getComputedStyle(element);
if (style.display === 'none' || style.visibility === 'hidden') {
return;
}

var id = $(element).addClass('viz-facade-loaded').attr('id');
setTimeout(function(){
// Add a short delay between each chart to avoid overloading the browser event loop.
showChart(id);
}, ( index + 1 ) * 100);
});

// interate through all charts that are to be lazy-loaded and observe each one.
Expand Down

0 comments on commit 0add303

Please sign in to comment.