Skip to content

Commit c2db879

Browse files
refactor: simplify the rendering
1 parent 6f8a45f commit c2db879

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

js/render-facade.js

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,6 @@ var vizClipboard1=null;
107107
registerDefaultActions();
108108
});
109109

110-
// Refresh charts if chart not generated.
111-
function refreshEachCharts() {
112-
if ( 'object' === typeof window.fusionAnimationsVars ) {
113-
return;
114-
}
115-
setTimeout( function() {
116-
displayChartsOnFrontEnd();
117-
}, 100 );
118-
}
119-
120110
function initChartDisplay() {
121111
if(visualizer.is_front == true){ // jshint ignore:line
122112
displayChartsOnFrontEnd();
@@ -139,22 +129,12 @@ var vizClipboard1=null;
139129

140130
function displayChartsOnFrontEnd() {
141131

142-
// Render the charts that are not lazy-loaded and with no errors.
143-
var nonLazyLoadedCharts = $('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error');
144-
145-
if ( nonLazyLoadedCharts.length ) {
146-
nonLazyLoadedCharts.each(function(index, element){
147-
if ( $(element).is(':visible') ) {
148-
var id = $(element).addClass('viz-facade-loaded').attr('id');
149-
showChart(id);
150-
}
151-
});
152-
153-
refreshEachCharts();
154-
} else {
155-
// Remove the loaded status for charts that are empty.
156-
$( 'div.viz-facade-loaded:not(.visualizer-lazy):not(.visualizer-cw-error):empty' ).removeClass( 'viz-facade-loaded' );
157-
}
132+
$('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){
133+
if ( $(element).is(':visible') ) {
134+
var id = $(element).addClass('viz-facade-loaded').attr('id');
135+
showChart(id);
136+
}
137+
});
158138

159139
// interate through all charts that are to be lazy-loaded and observe each one.
160140
$('div.visualizer-front.visualizer-lazy').each(function(index, element){

0 commit comments

Comments
 (0)