| @@ -127,18 +127,32 @@ | ||
| 127 | 127 | $('body').trigger('visualizer:render:chart:start', viz); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | function displayChartsOnFrontEnd() { |
| 131 | + $(window).on('scroll', function() { | |
| 132 | + $('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){ | |
| 133 | + // Do not render charts that are intentionally hidden. | |
| 134 | + const style = window.getComputedStyle(element); | |
| 135 | + if (style.display === 'none' || style.visibility === 'hidden') { | |
| 136 | + return; | |
| 137 | + } | |
| 131 | 138 | |
| 132 | - $('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){ | |
| 139 | + const id = $(element).addClass('viz-facade-loaded').attr('id'); | |
| 140 | + setTimeout(function(){ | |
| 141 | + // Add a short delay between each chart to avoid overloading the browser event loop. | |
| 142 | + showChart(id); | |
| 143 | + }, ( index + 1 ) * 100); | |
| 144 | + }); | |
| 145 | + }); | |
| 133 | 146 | |
| 147 | + $('div.visualizer-front-container:not(.visualizer-lazy-render)').each(function(index, element){ | |
| 134 | 148 | // Do not render charts that are intentionally hidden. |
| 135 | - var style = window.getComputedStyle(element); | |
| 149 | + const style = window.getComputedStyle($(element).find('.visualizer-front')[0]); | |
| 136 | 150 | if (style.display === 'none' || style.visibility === 'hidden') { |
| 137 | 151 | return; |
| 138 | 152 | } |
| 139 | - | |
| 140 | - var id = $(element).addClass('viz-facade-loaded').attr('id'); | |
| 153 | + | |
| 154 | + const id = $(element).find('.visualizer-front').addClass('viz-facade-loaded').attr('id'); | |
| 141 | 155 | setTimeout(function(){ |
| 142 | 156 | // Add a short delay between each chart to avoid overloading the browser event loop. |
| 143 | 157 | showChart(id); |
| 144 | 158 | }, ( index + 1 ) * 100); |