I have an internal report with multiple graphs that used to work well for a 
long time. 

Suddenly without any change on my side it shows only the first graph in the 
page. The other graphs have similar calls and the data looks OK but the 
graph is empty. No error is reported.

After debugging I saw that if I add a debugger statement in the beginning 
of the setOnLoadCallback function (which is called multiple times once for 
each graph). and then I run it manually after the code breaks in the 
breakpoint. All the graphs show,.

So it is not a data issue. its some kind of nasty timing issue.

Below is the actual code: 

Basically if I add debugger; where it says "// debugger here helps" and 
have the code run the code manually each time it stops. all the graphs will 
display. if not only the first graph displays.


<div id='div_46133_11159_RET_24832316219'></div>
<script type='text/javascript'>
google.setOnLoadCallback(drawgraphs_46133_11159_24832316219);
function drawgraphs_46133_11159_24832316219 () {
// debugger here helps
var conversiongraph_data = new google.visualization.DataTable();
conversiongraph_data.addColumn('number', 'time_slot');
conversiongraph_data.addColumn('number', 'Group');
conversiongraph_data.addColumn('number', 'Control');
conversiongraph_data.addColumn('number', 'Traffic volume');
conversiongraph_data.addRows([
[-126,1.308,1.220, 47363 ] ,  [-102,1.509,1.446, 43549 ] , 
 [-78,1.274,1.352, 43467 ] ,  [-54,1.329,1.405, 44394 ] , 
 [-30,1.106,1.099, 34343 ] ,  [-6,1.292,1.322, 6071 ] 
 
]);
 var options = {
 
chart: {
 title: 'conversion rate'
},
width: 1200,
height: 300,
axes: {
y:{
 Conv: {label: 'conversion rate %'},
 Vol: {label:'Volume (sessions)'}
}
},
 
  series: {
// Gives each series an axis name that matches the Y-axis below.
0: {axis: 'Conv'},
1: {axis: 'Conv'},
2: {axis: 'Vol'}
},
colors: ['red', 'blue', 'lightgray']
 };
  
var chart = new 
google.charts.Line(document.getElementById('div_46133_11159_RET_24832316219')); 
// material chart style
chart.draw(conversiongraph_data, options);
   
}
 
 </script>
 
     
<div id='div_46133_11159_RET_18779513343'></div>
<script type='text/javascript'>
google.setOnLoadCallback(drawgraphs_46133_11159_18779513343);
function drawgraphs_46133_11159_18779513343 () {
// debugger here helps
var conversiongraph_data = new google.visualization.DataTable();
conversiongraph_data.addColumn('number', 'time_slot');
conversiongraph_data.addColumn('number', 'Group');
conversiongraph_data.addColumn('number', 'Control');
conversiongraph_data.addColumn('number', 'Traffic volume');
conversiongraph_data.addRows([
[-126,8.291,8.106, 47363 ] ,  [-102,8.529,8.612, 43549 ] , 
 [-78,8.638,8.664, 43467 ] ,  [-54,9.006,9.310, 44394 ] , 
 [-30,8.525,8.762, 34343 ] ,  [-6,9.164,9.201, 6071 ] 
 
]);
 var options = {
 
chart: {
 title: 'Add to cart'
},
width: 1200,
height: 300,
axes: {
y:{
 Conv: {label: 'Add to cart %'},
 Vol: {label:'Volume (sessions)'}
}
},
 
  series: {
// Gives each series an axis name that matches the Y-axis below.
0: {axis: 'Conv'},
1: {axis: 'Conv'},
2: {axis: 'Vol'}
},
colors: ['red', 'blue', 'lightgray']
 };
  
var chart = new 
google.charts.Line(document.getElementById('div_46133_11159_RET_18779513343')); 
// material chart style
chart.draw(conversiongraph_data, options);
   
}
 
 </script>
  

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/64a296a1-0838-4b6c-8ef4-8c0d1e68cf7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to