Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple charts facade and small google fix #1065

Merged
merged 6 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions js/render-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* global jQuery */
var vizClipboard1=null;
(function($, visualizer){

function initActionsButtons(v) {
if($('a.visualizer-chart-shortcode').length > 0 && vizClipboard1 === null) {
vizClipboard1 = new ClipboardJS('a.visualizer-chart-shortcode'); // jshint ignore:line
Expand Down Expand Up @@ -107,19 +107,9 @@ var vizClipboard1=null;
registerDefaultActions();
});

// Refresh charts if chart not generated.
function refreshEachCharts() {
if ( 'object' === typeof window.fusionAnimationsVars ) {
return;
}
setTimeout( function() {
displayChartsOnFrontEnd();
}, 100 );
}

function initChartDisplay() {
if(visualizer.is_front == true){ // jshint ignore:line
displayChartsOnFrontEnd();
displayChartsOnFrontEnd();
Soare-Robert-Daniel marked this conversation as resolved.
Show resolved Hide resolved
}else{
showChart();
}
Expand All @@ -138,14 +128,12 @@ var vizClipboard1=null;
}

function displayChartsOnFrontEnd() {
// display all charts that are NOT to be lazy-loaded.
$( 'div.viz-facade-loaded:not(.visualizer-lazy):not(.visualizer-cw-error):empty' ).removeClass( 'viz-facade-loaded' );
$('div.visualizer-front:not(.visualizer-lazy):not(.viz-facade-loaded)').each(function(index, element){

$('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');
showChart(id);
}
refreshEachCharts();
});

// interate through all charts that are to be lazy-loaded and observe each one.
Expand Down
9 changes: 9 additions & 0 deletions js/render-google.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ var isResizeRequest = false;
var rendered_charts = [];

function renderChart(id) {

if ( ! all_charts || 0 === Object.keys( all_charts ).length ) {
Soare-Robert-Daniel marked this conversation as resolved.
Show resolved Hide resolved
return;
}

var chart = all_charts[id];
var hasAnnotation = false;

if ( ! chart ) {
return;
}

// re-render the chart only if it doesn't have annotations and it is on the front-end
// this is to prevent the chart from showing "All series on a given axis must be of the same data type" during resize.
// remember, some charts do not support annotations so they should not be included in this.
Expand Down
Loading