Skip to content

Commit

Permalink
Fix google chart library conflict with other plugins #801
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed May 13, 2021
1 parent e254897 commit 5ea3b31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
wpmvtv = wpmv.toolbar.visualizer;
mediaFrame = wpmv.MediaFrame.Post;

g.charts.load("current", { packages: ["corechart", "geochart", "gauge", "table", "timeline"] });
g.load('visualization', 'current', { packages: ["corechart", "geochart", "gauge", "table", "timeline"] });

wpmv.MediaFrame.Post = mediaFrame.extend({
initialize: function() {
Expand Down
17 changes: 9 additions & 8 deletions js/render-google.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,15 @@ var __visualizer_chart_images = [];
}

objects = {};
google.charts.load("current", {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language});
google.charts.setOnLoadCallback(function() {
gv = google.visualization;
all_charts = v.charts;
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
renderChart(v.id);
} else {
render();
google.load( 'visualization', 'current', {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language,
callback: function () {
gv = google.visualization;
all_charts = v.charts;
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
renderChart(v.id);
} else {
render();
}
}
});
});
Expand Down

0 comments on commit 5ea3b31

Please sign in to comment.