Skip to content

Commit 5ea3b31

Browse files
Fix google chart library conflict with other plugins #801
1 parent e254897 commit 5ea3b31

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

js/media.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
wpmvtv = wpmv.toolbar.visualizer;
66
mediaFrame = wpmv.MediaFrame.Post;
77

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

1010
wpmv.MediaFrame.Post = mediaFrame.extend({
1111
initialize: function() {

js/render-google.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,15 @@ var __visualizer_chart_images = [];
451451
}
452452

453453
objects = {};
454-
google.charts.load("current", {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language});
455-
google.charts.setOnLoadCallback(function() {
456-
gv = google.visualization;
457-
all_charts = v.charts;
458-
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
459-
renderChart(v.id);
460-
} else {
461-
render();
454+
google.load( 'visualization', 'current', {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language,
455+
callback: function () {
456+
gv = google.visualization;
457+
all_charts = v.charts;
458+
if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line
459+
renderChart(v.id);
460+
} else {
461+
render();
462+
}
462463
}
463464
});
464465
});

0 commit comments

Comments
 (0)